HHH-18216 add StatelessSession.getIdentifier()
Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
386bb1138a
commit
1a5456dde1
|
@ -286,4 +286,15 @@ public interface StatelessSession extends SharedSessionContract {
|
|||
* @since 6.0
|
||||
*/
|
||||
void fetch(Object association);
|
||||
|
||||
/**
|
||||
* Return the identifier value of the given entity, which may be detached.
|
||||
*
|
||||
* @param entity a persistent instance associated with this session
|
||||
*
|
||||
* @return the identifier
|
||||
*
|
||||
* @since 6.6
|
||||
*/
|
||||
Object getIdentifier(Object entity);
|
||||
}
|
||||
|
|
|
@ -769,6 +769,12 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getIdentifier(Object entity) throws HibernateException {
|
||||
checkOpen();
|
||||
return getFactory().getPersistenceUnitUtil().getIdentifier(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoCloseSessionEnabled() {
|
||||
return getFactory().getSessionFactoryOptions().isAutoCloseSessionEnabled();
|
||||
|
|
|
@ -136,7 +136,7 @@ public class LifecycleMethod extends AbstractAnnotatedMethod {
|
|||
declaration
|
||||
.append("\t\tif (")
|
||||
.append(sessionName)
|
||||
.append(".getFactory().getPersistenceUnitUtil().getIdentifier(")
|
||||
.append(".getIdentifier(")
|
||||
.append(iterateParameter ? "_entity" : parameterName)
|
||||
.append(") == null)\n")
|
||||
.append("\t\t\t")
|
||||
|
|
Loading…
Reference in New Issue