Setter Methods not getting invoked with eclispe link [message #1229500] |
Thu, 09 January 2014 15:16 |
Sendhil Kumar Messages: 7 Registered: January 2014 |
Junior Member |
|
|
Hi All,
While doing following querying,
List<JurisdictionVoLink> jurisdictionList = (List<JurisdictionVoLink>)entityManager.createQuery("SELECT x FROM JurisdictionVoLink x").getResultList();
I could able to get the list properly.
But only my default no argument constructor getting invoked. And no setter methods are being invoked. I have to do some additonal operation on my setters, so I want those to be invoked on every query.
Actually with hibernate, all setters will be invoked. Am new to JPA, not sure why its not happening with this.
Can anyone help me on this. Below I have shared my entity mapping and entity class.
Following are the properties am using in persistence.xml,
<properties>
<property name="eclipselink.weaving" value="false"/>
<property name="eclipselink.cache.shared.default" value="false"/>
</properties>
My entity mapping,
<entity-mappings>
<description>Users</description>
<entity name="JurisdictionVoLink" class="com.csfb.csar.exman.shared.work.JurisdictionVoLink" >
<table name="VEM_JURISDICTION"></table>
<attributes>
<id name="dbId" type="java.lang.Long" >
<column name = "JURISDICTION_ID"/>
</id>
<basic name="description" type="java.lang.String" >
<column name="DESCRIPTION"/>
</basic>
</attributes>
</entity>
</entity-mappings>
And my entity class,
public class JurisdictionVoLink implements java.io.Serializable, Cloneable {
private Long dbId;
private String description;
/** default constructor */
public JurisdictionVoLink() {
System.out.println("default constructor JurisdictionVoLink invoked");
}
public JurisdictionVoLink(Long dbId, String description) {
super();
System.out.println("All argument constructor JurisdictionVoLink invoked");
this.dbId = dbId;
this.description = description;
}
public Long getDbId() {
return dbId;
}
public void setDbId(Long dbId) {
this.dbId = dbId;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public JurisdictionVoLink clone(){
System.out.println("Clone JurisdictionVoLink invoked");
JurisdictionVoLink obj = null;
try{
obj = (JurisdictionVoLink) super.clone();
}catch(CloneNotSupportedException e){
e.printStackTrace();
}
return obj;
}
public boolean equals(Object obj){
System.out.println("equals JurisdictionVoLink invoked");
JurisdictionVoLink workItem = null;
workItem = (JurisdictionVoLink) obj;
if(workItem.dbId.equals(dbId))return true;
return false;
}
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.04835 seconds