|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.databinder.models.LoadableWritableModel
net.databinder.models.hib.HibernateObjectModel
public class HibernateObjectModel
Model loaded and persisted by Hibernate. This central Databinder class can be initialized with an entity ID, different types of queries, or an existing persistent object. As a writable Wicket model, the object it contains may be swapped at any time for a different persistent object, a Serializable object, or null.
| Constructor Summary | |
|---|---|
HibernateObjectModel()
Construct with no object. |
|
HibernateObjectModel(java.lang.Class objectClass)
Constructor for a model with no existing persistent object. |
|
HibernateObjectModel(java.lang.Class objectClass,
CriteriaBuilder criteriaBuilder)
Construct with a class and criteria binder that return exactly one result. |
|
HibernateObjectModel(java.lang.Class objectClass,
java.io.Serializable entityId)
Create a model bound to the given class and entity id. |
|
HibernateObjectModel(java.lang.Object persistentObject)
Construct with an entity. |
|
HibernateObjectModel(QueryBuilder queryBuilder)
Construct with a query builder that returns exactly one result, used for custom query objects. |
|
HibernateObjectModel(java.lang.String queryString,
QueryBinder queryBinder)
Construct with a query and binder that return exactly one result. |
|
| Method Summary | |
|---|---|
void |
checkBinding()
Checks if the model is retaining an object this has since become a persistent entity. |
void |
clearPersistentObject()
Deprecated. use unbind() |
boolean |
equals(java.lang.Object obj)
Compares contained objects if present, otherwise calls super-implementation. |
java.lang.Object |
getFactoryKey()
|
java.io.Serializable |
getIdentifier()
|
boolean |
getRetainUnsaved()
When retainUnsaved is true (the default) and the model is not bound, the model object must be Serializable as it is retained in the Web session between requests. |
java.io.Serializable |
getVersion()
Uses version annotation to find version for this Model's object. |
int |
hashCode()
|
boolean |
isBound()
"bound" models are those that can be loaded from persistent storage by a known id or query. |
protected java.lang.Object |
load()
Load the object through Hibernate, contruct a new instance if it is not bound to an id, or use unsaved retained object. |
HibernateObjectModel |
setFactoryKey(java.lang.Object key)
Set a factory key other than the default (null). |
void |
setObject(java.lang.Object object)
Change the persistent object contained in this model. |
void |
setRetainUnsaved(boolean retainUnsaved)
Unsaved Serializable objects can be retained between requests. |
void |
unbind()
Disassociates this object from any persistent object, but retains the class for constructing a blank copy if requested. |
| Methods inherited from class net.databinder.models.LoadableWritableModel |
|---|
detach, getObject, isAttached, onAttach, onDetach, setTempModelObject, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.apache.wicket.model.IModel |
|---|
getObject |
| Methods inherited from interface org.apache.wicket.model.IDetachable |
|---|
detach |
| Constructor Detail |
|---|
public HibernateObjectModel(java.lang.Class objectClass,
java.io.Serializable entityId)
objectClass - class to be loaded and stored by HibernateentityId - id of the persistent objectpublic HibernateObjectModel(java.lang.Class objectClass)
objectClass - class to be loaded and stored by Hibernatepublic HibernateObjectModel(java.lang.Object persistentObject)
persistentObject - should be previously persisted or Serializable for temp storage.
public HibernateObjectModel(java.lang.String queryString,
QueryBinder queryBinder)
queryString - query returning one resultqueryBinder - bind id or other parameters
public HibernateObjectModel(java.lang.Class objectClass,
CriteriaBuilder criteriaBuilder)
objectClass - class of object for root criteriacriteriaBuilder - builder to apply criteria restrictionspublic HibernateObjectModel(QueryBuilder queryBuilder)
queryBuilder - builder to create and bind query objectpublic HibernateObjectModel()
| Method Detail |
|---|
public java.lang.Object getFactoryKey()
public HibernateObjectModel setFactoryKey(java.lang.Object key)
key - session factory key
public void setObject(java.lang.Object object)
setObject in interface org.apache.wicket.model.IModelobject - must be an entity contained in the current Hibernate session, or Serializable, or nullpublic java.io.Serializable getIdentifier()
public void clearPersistentObject()
unbind()
protected java.lang.Object load()
load in class LoadableWritableModelpublic void checkBinding()
public java.io.Serializable getVersion()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic void unbind()
unbind in interface BindingModelHibernateObjectModel(Class objectClass)public boolean isBound()
isBound in interface BindingModelpublic boolean getRetainUnsaved()
public void setRetainUnsaved(boolean retainUnsaved)
retainUnsaved - set to true to retain unsaved objects
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||