@Transactional public class ProductDaoImpl<T extends Product> extends AbstractHierarchyDaoImpl<T> implements ProductDao<T>
ProductDao
FILTER_PARENTS, FILTER_PARENTS_IMMEDIATE, relEntitiesDelTransformeremct, tFILTER_PARENTS, FILTER_PARENTS_IMMEDIATE| Constructor and Description |
|---|
ProductDaoImpl() |
ProductDaoImpl(Class<T> ref) |
| Modifier and Type | Method and Description |
|---|---|
Long |
count(Query<T> query)
Deprecated.
|
int |
countFilterParents(T parent,
boolean immediate)
Return number of nodes that are parents under the specified parent Node
The parent node must have a valid Product.getId() or HierarchialDomainObject.getHierarchy(); immediate is false. |
Long |
delete(Collection<Long> ids) |
Long |
delete(Long id)
A special Delete operation on the entity that will remove the entity and related entities based on id.
|
void |
delete(T persistentObject) |
void |
deleteSubHierarchy(T rootNode) |
List<T> |
filterParents(T parent,
boolean immediate)
Return
List of nodes that are parents under the specified parent Node The parent node must have a valid Product.getId() or HierarchialDomainObject.getHierarchy(); immediate is false. |
List<ProductAlias> |
getAliasForProduct(T product)
For a given Product (T) derive all its
ProductAlias |
String |
getLastChildHierarchyCode(T parent)
Get last childs hierarchy code
|
protected String |
getNativeEntityName(String entityName)
Calling parent class Dao methods calls some native DB calls that executes
EntityManager.createNativeQuery(String). |
List<T> |
getParents(T product,
boolean includeThis,
String DEFAULT_PRODUCT_NAME,
QueryOptimizer queryOptimizer)
Get parents for the product.
|
void |
init() |
boolean |
isExistsAsParent(T node)
A quick check to see if the current node is a parent
|
T |
load(Object id) |
T |
load(Object id,
Class entityClass)
In some situations the DAO represents an Interface or perhaps a parent of the actual Entity./
The exact type of the entity would have to be Supplied.
|
Page<T> |
loadPage(Query<T> query)
Load data in paginated fashion.
|
String |
makeSpaceForNodeInParent(T node,
T parent,
Integer sequence) |
void |
move(T product,
T newParent,
Integer sequence) |
List |
query(String ql,
String dialect,
Object... params)
Execute a raw Query in the native implementation language.
|
Page |
query(String ql,
String dialect,
PageInfo pageInfo,
Object... params)
Execute a raw Query in the native implementation language.
|
ProductAlias |
save(ProductAlias alias)
This method does a
EntityManager.merge(Object) operation If one wants to Insert a new record without merge and using an existing parent object, one may directl hack it via the EntityManager: ProductAlias pa = new ProductAlias(); pa.setProduct(existingP); Product proxyParent = new Product(); proxyParent.setId(p.getParentId()); //Avoid having to query for parent again pa.setParent(proxyParent); em.persist(pa); |
ProductAttribute |
save(ProductAttribute attrib)
Ability to update a single
ProductAttribute without updating the whole Product
Useful in Ajax situations where we want to save a partial aspect of the product only. |
T |
save(T product) |
convert, delete, delete, deleteSubHierarchy, deleteSubHierarchy, filterParents, getLastChildHierarchyCode, getParents, getPersistTransformer, getRelEntitiesDelTransformer, makeSpaceForNodeInParent, move, setPersistTransformer, setRelEntitiesDelTransformer, shiftHierarchy, verifyHierarchyconditionConstruct, ensureRowIsEntity, ensureRowIsEntity, getEntityInstance, getQueryObject, query, query, queryPage, queryPagegetEntityManager, paginate, setEntityManager, updateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconvertgetEntityInstance, query, query, queryPage, queryPageprotected String getNativeEntityName(String entityName)
EntityManager.createNativeQuery(String).
Which implies the entityName is case sensitive. If not careful can generate an error like
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'needledu_ecom.Product' doesn't exist
Keeping name of entity name same as in DB to be safe.getNativeEntityName in class GenericDaoImpl<T extends Product>@PostConstruct public void init()
@Deprecated @Transactional(readOnly=true) public Long count(Query<T> query) throws Exception
AbstractQueryableDaoImplQuery and on Queryable fields only.
Query.setNullSet(Set)
Queryable fields will face problems.count in interface QueryableDao<T extends Product>count in class AbstractQueryableDaoImpl<T extends Product>query - as QueryableException@Transactional(readOnly=true) public Page<T> loadPage(Query<T> query)
ProductDaoloadPage in interface ProductDao<T extends Product>loadPage in class AbstractHierarchyDaoImpl<T extends Product>@Transactional(readOnly=false) public Long delete(Long id)
GenericDaodelete in interface GenericDao<T extends Product>delete in class GenericDaoImpl<T extends Product>Long@Transactional(readOnly=false) public Long delete(Collection<Long> ids)
delete in interface ProductDao<T extends Product>@Transactional(readOnly=false) public T save(T product)
save in interface GenericDao<T extends Product>save in class AbstractHierarchyDaoImpl<T extends Product>@Transactional(readOnly=false) public void move(T product, T newParent, Integer sequence) throws Exception
move in interface ProductDao<T extends Product>Exceptionpublic List<T> getParents(T product, boolean includeThis, String DEFAULT_PRODUCT_NAME, QueryOptimizer queryOptimizer)
ProductDaogetParents in interface ProductDao<T extends Product>product - as productDEFAULT_PRODUCT_NAME - as String of the default product name. If empty, then its not included.queryOptimizer - as QueryOptimizerpublic void deleteSubHierarchy(T rootNode) throws Exception
deleteSubHierarchy in interface ProductDao<T extends Product>Exception@Transactional public String getLastChildHierarchyCode(T parent)
getLastChildHierarchyCode in interface ProductDao<T extends Product>@Transactional public List<T> filterParents(T parent, boolean immediate)
List of nodes that are parents under the specified parent Node Product.getId() or HierarchialDomainObject.getHierarchy(); immediate is false.filterParents in interface ProductDao<T extends Product>parent - as Timmediate - as boolean; if true will fetch only parents immediately under the specified parent@Transactional public int countFilterParents(T parent, boolean immediate)
Product.getId() or HierarchialDomainObject.getHierarchy(); immediate is false.countFilterParents in interface ProductDao<T extends Product>parent - as Timmediate - as boolean; if true will fetch only parents immediately under the specified parent@Transactional public String makeSpaceForNodeInParent(T node, T parent, Integer sequence)
makeSpaceForNodeInParent in interface ProductDao<T extends Product>@Transactional public ProductAttribute save(ProductAttribute attrib)
ProductDaoProductAttribute without updating the whole Product
save in interface ProductDao<T extends Product>attrib - as ProductAttributeProductAttribute@Transactional public ProductAlias save(ProductAlias alias)
EntityManager.merge(Object) operation save in interface ProductDao<T extends Product>@Transactional public List<ProductAlias> getAliasForProduct(T product)
ProductDaoProductAliasgetAliasForProduct in interface ProductDao<T extends Product>public boolean isExistsAsParent(T node)
AbstractHierarchyDaoImplisExistsAsParent in interface ProductDao<T extends Product>isExistsAsParent in class AbstractHierarchyDaoImpl<T extends Product>@Transactional(readOnly=false) public void delete(T persistentObject)
delete in interface GenericDao<T extends Product>delete in class GenericDaoImpl<T extends Product>@Transactional(readOnly=true) public T load(Object id, Class entityClass)
GenericDaoload in interface GenericDao<T extends Product>load in class GenericDaoImpl<T extends Product>id - as Id for EntityentityClass - as Class of entity@Transactional(readOnly=true) public T load(Object id)
load in interface GenericDao<T extends Product>load in class GenericDaoImpl<T extends Product>@Transactional(readOnly=true) public List query(String ql, String dialect, Object... params) throws Exception
GenericDaoImplquery in interface FreeQueryquery in class GenericDaoImpl<T extends Product>ql - as String in native Schema languagedialect - as String. NULL or empty or "NATIVE" implies NATIVE, "JPA" implies JPA will be used. Additional dialects can be supported but they will be implementation dependent.params - as Query parameters to the string.
ListException@Transactional(readOnly=true) public Page query(String ql, String dialect, PageInfo pageInfo, Object... params) throws Exception
GenericDaoImplquery in interface FreeQueryquery in class GenericDaoImpl<T extends Product>ql - as String in native Schema languagedialect - as String. NULL or empty or "NATIVE" implies NATIVE, "JPA" implies JPA will be used. Additional dialects can be supported but they will be implementation dependent.pageInfo - as PageInfo for pagination of resultparams - as Query parameters to the string
PageExceptionCopyright © 2018. All rights reserved.