openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wahoobill <brodrig...@consert.com>
Subject OpenJPA throws persistence exception when tryin to persist WAS7.0 entities
Date Mon, 18 Jan 2010 19:08:37 GMT

We are running WAS 7.0.0.5 and OpenJPA 1.2.2 on our application. When we
attempt to perform a query to retrieve a list
of a table which has foreign keys, it fails with the attached exception.

the Entitys are as follows:

public class TbUser implements Serializable {
@Id
@Column(name="USER_ID")
private int userId;
.....
@OneToMany(mappedBy="uid",fetch=FetchType.EAGER)
private Set<TbAccount> tbAccountCollection;
public class TbAccount implements Serializable {
@Id
@Column(name="ACCOUNT_ID")
private int accountId;

....
@ManyToOne(targetEntity = TbUser.class, optional = false)
@JoinColumn(name="USER_ID")
@ForeignKey(deleteAction=ForeignKeyAction.CASCADE)
private TbUser uid;

The business logic code is :

@NamedQueryTarget("getTbAccountByUserId")
public List<TbAccount> getTbAccountByUserId(TbUser user) {
EntityManager em = getEntityManager();
List<TbAccount> results = null;
try {
Query query = em.createNamedQuery("getTbAccountByUserId");
query.setParameter("uid_userid", user.getUserId());
results = (List<TbAccount>) query.getResultList();
} finally {
em.close();
}
return results;
} 

and finally the query from above is:

@NamedQuery(name="getTbAccountByUserId", query = "SELECT t FROM TbAccount t
WHERE t.uid.userId = :uid_userId")})
A snipit of the exception is :

11:43:34:984 EST] 0000001a servlet I
com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: KermitEAR
[/KermitWeb] [/DisplayDeviceSettings.jsp]: Initialization successful.
1/12/10 11:43:34:828 EST 0000001a SystemErr R
<openjpa-1.2.2-SNAPSHOT-r422266:778978M-OPENJPA-975 nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: null
1/12/10 11:43:34:828 EST 0000001a SystemErr R at
org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:875)
1/12/10 11:43:34:828 EST 0000001a SystemErr R at
org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:774)

The complete exception is attached.
Stuck -- any help would be very appreciated

Bill
brodriguez@consert.com
http://n2.nabble.com/file/n4415553/entity_excp.rtf entity_excp.rtf 
-- 
View this message in context: http://n2.nabble.com/OpenJPA-throws-persistence-exception-when-tryin-to-persist-WAS7-0-entities-tp4415553p4415553.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message