Java Mailing List Archive

http://www.gg3721.com/

Home » users.openjpa »

OpenJPA-1.1.0/Spring-2.x JPATemplate.find not working for composite
PK

Enrico Goosen

2008-06-14


Author LoginPost Reply

I'm not sure if I should post this here on in the Spring forum, but here
goes...

This method doesn't work:
public T getObjectByID(PK id) {
 return (T) getJpaTemplate().find(type, id);
}

I'm trying to find an entity using a composite PK:
TblPdtbnfPK pk = new TblPdtbnfPK();
pk.pdtbnfId = tblPdtbnf.getPdtbnfId();
pk.scmpdtId = tblPdtbnf.getScmpdtId();
tblPdtbnf = getPdtbnfDAO().getObjectByID(pk); //this returns null

When I check the debug SQL output, the select statement is only finding on
one of the fields, not on both PK fields.
eg. select .... from TBL_PDTBNF a where a.SCMPDT_ID = ? //leaving out the
second field PDTBNF_ID

If I test without Spring, it works.
--
Sent from the OpenJPA Users mailing list archive at Nabble.com.

©2008 gg3721.com - Jax Systems, LLC, U.S.A.