to.etc.domui.hibernate.model
Class HibernateModelCopier

java.lang.Object
  extended by to.etc.domui.util.db.QBasicModelCopier
      extended by to.etc.domui.hibernate.model.HibernateModelCopier
All Implemented Interfaces:
IModelCopier

public class HibernateModelCopier
extends QBasicModelCopier


Nested Class Summary
 
Nested classes/interfaces inherited from class to.etc.domui.util.db.QBasicModelCopier
QBasicModelCopier.CopyInfo
 
Constructor Summary
HibernateModelCopier()
           
 
Method Summary
protected  QPersistentObjectState getObjectState(QDataContext dc, java.lang.Class<?> pclass, java.lang.Object pk)
           
protected  QPersistentObjectState getObjectState(QDataContext dc, java.lang.Object instance)
          Determine the object state using internal Hibernate data structures.
protected  boolean isPersistedEntry(QDataContext dc, java.lang.Object instance)
           
protected
<T> boolean
isUnloadedChildList(T source, PropertyMetaModel<?> pmm)
           
protected
<T> boolean
isUnloadedParent(T source, PropertyMetaModel<?> pmm)
           
protected  void save(QBasicModelCopier.CopyInfo ci, java.lang.Object instance)
          Sigh.
 
Methods inherited from class to.etc.domui.util.db.QBasicModelCopier
assertPrivateContext, copyInstanceDeep, copyInstanceShallow, deleteFromTarget, loadCopyFrom
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateModelCopier

public HibernateModelCopier()
Method Detail

isUnloadedChildList

protected <T> boolean isUnloadedChildList(T source,
                                          PropertyMetaModel<?> pmm)
                               throws java.lang.Exception
Specified by:
isUnloadedChildList in class QBasicModelCopier
Throws:
java.lang.Exception

isUnloadedParent

protected <T> boolean isUnloadedParent(T source,
                                       PropertyMetaModel<?> pmm)
                            throws java.lang.Exception
Specified by:
isUnloadedParent in class QBasicModelCopier
Throws:
java.lang.Exception

isPersistedEntry

protected boolean isPersistedEntry(QDataContext dc,
                                   java.lang.Object instance)
                            throws java.lang.Exception
Throws:
java.lang.Exception

save

protected void save(QBasicModelCopier.CopyInfo ci,
                    java.lang.Object instance)
             throws java.lang.Exception
Sigh. Overridden to force Hibernate to bloody use an existing primary key on NEW object, damnit. See Here.

Overrides:
save in class QBasicModelCopier
Throws:
java.lang.Exception
See Also:
QBasicModelCopier.save(to.etc.domui.util.db.QBasicModelCopier.CopyInfo, java.lang.Object)

getObjectState

protected QPersistentObjectState getObjectState(QDataContext dc,
                                                java.lang.Object instance)
                                         throws java.lang.Exception
Determine the object state using internal Hibernate data structures. Code was mostly stolen from DefaultFlushEntityEventListener#dirtyCheck()

Specified by:
getObjectState in class QBasicModelCopier
Parameters:
dc -
instance -
Returns:
Throws:
java.lang.Exception

getObjectState

protected QPersistentObjectState getObjectState(QDataContext dc,
                                                java.lang.Class<?> pclass,
                                                java.lang.Object pk)
                                         throws java.lang.Exception
Specified by:
getObjectState in class QBasicModelCopier
Throws:
java.lang.Exception