Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Setter Methods not getting invoked with eclispe link(Setter Methods not getting invoked with eclispe link)
Setter Methods not getting invoked with eclispe link [message #1229500] Thu, 09 January 2014 10:16 Go to next message
Eclipse UserFriend
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;
}

}


Re: Setter Methods not getting invoked with eclispe link [message #1229576 is a reply to message #1229500] Thu, 09 January 2014 13:42 Go to previous message
Eclipse UserFriend
EclipseLink orm.xml processing seems to default to field access, which might be different in other providers.
See http://en.wikibooks.org/wiki/Java_Persistence/Mapping#Access_Type for information on the access type.

If you want consistent portable code, you will need to specify the access type in your entity, for example:
<entity name="JurisdictionVoLink" class="com.csfb.csar.exman.shared.work.JurisdictionVoLink" access="PROPERTY">

Best Regards,
Chris
Previous Topic:How to configure Inner Class as an Entity in Mapping File
Next Topic:parse orm mapping in json format
Goto Forum:
  


Current Time: Wed Jul 23 14:45:39 EDT 2025

Powered by FUDForum. Page generated in 0.03838 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top