|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.silverpeas.persistence.model.AbstractEntity<ENTITY,IDENTIFIER_TYPE>
org.silverpeas.persistence.model.jpa.AbstractJpaEntity<ENTITY,IDENTIFIER_TYPE>
ENTITY
- specify the class name of the entity itself which is handled by a repository
manager.IDENTIFIER_TYPE
- the identifier class name used by ENTITY
for its primary key
definition.@MappedSuperclass public abstract class AbstractJpaEntity<ENTITY extends Entity<ENTITY,IDENTIFIER_TYPE>,IDENTIFIER_TYPE extends EntityIdentifier>
This abstract class must be extended by all Silverpeas JPA entity definitions. All technical data, excepted the identifier, are handled at this level.
TheAbstractEntity.performBeforePersist()
and AbstractEntity.performBeforeUpdate()
method calls are handled at this level for JPA.
Please be careful into the child entity classes about the use of @PrePersist and @PreUpdate
annotations. In most of cases you don't need to use them, but to override AbstractEntity.performBeforePersist()
or AbstractEntity.performBeforeUpdate()
methods
without forgetting to play the super call.
Constructor Summary | |
---|---|
AbstractJpaEntity()
|
Method Summary | |
---|---|
Date |
getCreateDate()
Gets the date of the entity creation (in the persistence environment). |
String |
getCreatedBy()
Gets the free "created by" data. |
protected Class<IDENTIFIER_TYPE> |
getEntityIdentifierClass()
Gets the identifier class of the entity managed by the repository. |
String |
getId()
Gets the id of the entity. |
Date |
getLastUpdateDate()
Gets the last date and time of the entity update (in the persistence environment). |
String |
getLastUpdatedBy()
Gets the free "last updated by" data. |
Long |
getVersion()
Gets the version of the entity (in the persistence environment). |
boolean |
isPersisted()
Indicates if the entity is persisted (commonly if the entity has an id) |
void |
markAsModified()
By default, if no functional data is changed, last update date, last updated by and version technical data are not automatically updated on entity save operation. |
protected IDENTIFIER_TYPE |
newIdentifierInstance()
|
protected ENTITY |
setCreateDate(Date createDate)
|
ENTITY |
setCreatedBy(String createdBy)
|
protected ENTITY |
setId(String id)
Sets the id of the entity. |
protected ENTITY |
setLastUpdateDate(Date lastUpdateDate)
|
ENTITY |
setLastUpdatedBy(String lastUpdatedBy)
|
protected ENTITY |
setVersion(Long version)
Sets the version of the entity. |
Methods inherited from class org.silverpeas.persistence.model.AbstractEntity |
---|
clone, equals, getComponentInstanceId, getCreator, getLastUpdater, hasBeenModified, hashCode, performBeforePersist, performBeforeUpdate, setCreator, setLastUpdater |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractJpaEntity()
Method Detail |
---|
protected Class<IDENTIFIER_TYPE> getEntityIdentifierClass()
public boolean isPersisted()
Entity
isPersisted
in interface Entity<ENTITY extends Entity<ENTITY,IDENTIFIER_TYPE>,IDENTIFIER_TYPE extends EntityIdentifier>
isPersisted
in class AbstractEntity<ENTITY extends Entity<ENTITY,IDENTIFIER_TYPE>,IDENTIFIER_TYPE extends EntityIdentifier>
public String getId()
Entity
protected IDENTIFIER_TYPE newIdentifierInstance()
protected ENTITY setId(String id)
AbstractEntity
setId
in class AbstractEntity<ENTITY extends Entity<ENTITY,IDENTIFIER_TYPE>,IDENTIFIER_TYPE extends EntityIdentifier>
id
- the new id of the entity.
public String getCreatedBy()
Entity
public ENTITY setCreatedBy(String createdBy)
setCreatedBy
in class AbstractEntity<ENTITY extends Entity<ENTITY,IDENTIFIER_TYPE>,IDENTIFIER_TYPE extends EntityIdentifier>
public Date getCreateDate()
Entity
protected ENTITY setCreateDate(Date createDate)
setCreateDate
in class AbstractEntity<ENTITY extends Entity<ENTITY,IDENTIFIER_TYPE>,IDENTIFIER_TYPE extends EntityIdentifier>
public Date getLastUpdateDate()
Entity
protected ENTITY setLastUpdateDate(Date lastUpdateDate)
setLastUpdateDate
in class AbstractEntity<ENTITY extends Entity<ENTITY,IDENTIFIER_TYPE>,IDENTIFIER_TYPE extends EntityIdentifier>
public String getLastUpdatedBy()
Entity
public ENTITY setLastUpdatedBy(String lastUpdatedBy)
setLastUpdatedBy
in class AbstractEntity<ENTITY extends Entity<ENTITY,IDENTIFIER_TYPE>,IDENTIFIER_TYPE extends EntityIdentifier>
public Long getVersion()
Entity
protected ENTITY setVersion(Long version)
AbstractEntity
setVersion
in class AbstractEntity<ENTITY extends Entity<ENTITY,IDENTIFIER_TYPE>,IDENTIFIER_TYPE extends EntityIdentifier>
public void markAsModified()
Entity
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |