@Transactional public class UserDaoImpl<U extends User> extends AbstractQueryableDaoImpl<U> implements UserDao<U>
User
s & Credentials
User
entities, use different instances of this.
em
ct, t
ATTRIB_LIKE_NAME, ATTRIB_MODULE_NAMES
Constructor and Description |
---|
UserDaoImpl()
Deprecated.
|
UserDaoImpl(Class<U> t) |
UserDaoImpl(Class userClass,
Class credentialsClass) |
Modifier and Type | Method and Description |
---|---|
long |
countRaw(String query) |
Long |
delete(Long id)
A special Delete operation on the entity that will remove the entity and related entities based on id.
|
void |
delete(String userNameId)
Remove by Id
|
void |
delete(U persistentObject) |
void |
deleteCredentials(String userNameId)
Remove Credentials
|
protected String |
getCredentialEntityName() |
Credentials |
getCredentials(String userNameId)
Fetch
Credentials for a given userId. |
String |
getPassword(String userNameId)
Fetch password for a given userId.
|
String |
getQueryObjectName()
Deprecated.
|
U |
getUser(String fieldName,
Object value)
Quick lookup on the system to check if any user exists with the value for a given Field Name on the
User object |
U |
getUser(String fieldName,
Object value,
String entityTypeName)
Same as
UserDao.getUser(String, Object) , except here one can override the default Entity type being searched for |
protected String |
getUserEntityName() |
Class<U> |
getUserEntityType() |
String |
getUserIdFromAttribute(String attribName,
String value)
Sometimes we have to identify the userId from some attributes like email, phone number etc.
|
U |
load(Object id) |
U |
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.
|
U |
load(String userNameId)
Due to the abstract nature of
User the actually entity class is not known to load the actual User object. |
Page<U> |
loadPage(Query<U> query)
Load data in paginated fashion.
|
Page<U> |
loadPageRaw(String query,
PageInfo pageInfo) |
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.
|
void |
remove(String fieldName,
Object value,
String entityTypeName) |
void |
save(Credentials cred)
Save Credentials
|
U |
save(U user) |
U |
save(U user,
Credentials cred)
Save user & Credentials data in one transaction
|
conditionConstruct, count, ensureRowIsEntity, ensureRowIsEntity, getEntityInstance, getQueryObject, query, query, queryPage, queryPage
getEntityManager, getNativeEntityName, paginate, setEntityManager, update
@Deprecated public UserDaoImpl()
@Deprecated public final String getQueryObjectName()
protected final String getUserEntityName()
protected final String getCredentialEntityName()
public String getUserIdFromAttribute(String attribName, String value)
getUserIdFromAttribute
in interface UserDao<U extends User>
attribName
- as Stringvalue
- as String@Transactional(readOnly=true) public String getPassword(String userNameId) throws Exception
UserDao
getPassword
in interface UserDao<U extends User>
userNameId
- as String; userName or emailException
@Transactional(readOnly=true) public Credentials getCredentials(String userNameId) throws Exception
UserDao
Credentials
for a given userId. If there is no result or multiple results
it will throw an exception as an erroneous condition.getCredentials
in interface UserDao<U extends User>
userNameId
- as String; userName or emailCredentials
objectException
@Transactional(readOnly=false) public U save(U user, Credentials cred)
UserDao
@Transactional(readOnly=false) public U save(U user)
save
in interface GenericDao<U extends User>
save
in class GenericDaoImpl<U extends User>
@Transactional(readOnly=false) public void save(Credentials cred)
UserDao
@Transactional(readOnly=true) public U load(String userNameId) throws Exception
UserDao
User
the actually entity class is not known to load the actual User object.
For this reason the implementation is responsible for finding the right object based ona n id provided to it.@Transactional(readOnly=false) public void delete(String userNameId)
UserDao
@Transactional(readOnly=false) public void remove(String fieldName, Object value, String entityTypeName)
@Transactional(readOnly=false) public void deleteCredentials(String userNameId)
UserDao
deleteCredentials
in interface UserDao<U extends User>
@Transactional(readOnly=true) public long countRaw(String query)
@Transactional(readOnly=true) public Page<U> loadPage(Query<U> query) throws Exception
UserDao
@Transactional(readOnly=true) public Page<U> loadPageRaw(String query, PageInfo pageInfo)
loadPageRaw
in interface UserDao<U extends User>
pageInfo
- @Nullanble truePage
@Transactional(readOnly=true) public U getUser(String fieldName, Object value) throws Exception
UserDao
User
object@Transactional(readOnly=true) public U getUser(String fieldName, Object value, String entityTypeName) throws Exception
UserDao
UserDao.getUser(String, Object)
, except here one can override the default Entity type being searched forpublic Class<U> getUserEntityType()
getUserEntityType
in interface UserDao<U extends User>
@Transactional(readOnly=false) public void delete(U persistentObject)
delete
in interface GenericDao<U extends User>
delete
in class GenericDaoImpl<U extends User>
@Transactional(readOnly=true) public U load(Object id, Class entityClass)
GenericDao
load
in interface GenericDao<U extends User>
load
in class GenericDaoImpl<U extends User>
id
- as Id for EntityentityClass
- as Class
of entity@Transactional(readOnly=true) public U load(Object id)
load
in interface GenericDao<U extends User>
load
in class GenericDaoImpl<U extends User>
@Transactional(readOnly=false) public Long delete(Long id)
GenericDao
delete
in interface GenericDao<U extends User>
delete
in class GenericDaoImpl<U extends User>
Long
@Transactional(readOnly=true) public List query(String ql, String dialect, Object... params) throws Exception
GenericDaoImpl
query
in interface FreeQuery
query
in class GenericDaoImpl<U extends User>
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.
List
Exception
@Transactional(readOnly=true) public Page query(String ql, String dialect, PageInfo pageInfo, Object... params) throws Exception
GenericDaoImpl
query
in interface FreeQuery
query
in class GenericDaoImpl<U extends User>
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
Page
Exception
Copyright © 2018. All rights reserved.