File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes solution for EJB3.0 and Open JPA in WAS7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "solution for EJB3.0 and Open JPA in WAS7" Watch "solution for EJB3.0 and Open JPA in WAS7" New topic
Author

solution for EJB3.0 and Open JPA in WAS7

rajesh babu Y
Ranch Hand

Joined: Nov 12, 2010
Posts: 31
Hi All,

i am working on EJB3.0 and OpenJPA1.2.3 version on WAS7.

here i have a problem, the one to many assosiations are not picking data from database.

Earlier we used EJB3.0 and Toplink on Glassfish. we didn't find any problem at the time with one to many assosiations.

when we move from toplink to OpenJPA and glassfish to WAS7 these mappings are not supporting throwing
[12/9/10 9:00:06:068 CST] 00000018 BusinessExcep E CNTR0020E:
EJB threw an unexpected (non-declared) exception during invocation of method "stateExists" on bean "BeanId(lmt-33171#LLMT-ejb.jar#LocStateFacade, null)".

Exception data: <openjpa-1.2.3-SNAPSHOT-r422266:965640 nonfatal user error> org.apache.openjpa.persistence.ArgumentException:

An error occurred while parsing the query filter 'SELECT o FROM LocState o where o.deleted = false and o.country.id = 88 AND UPPER(o.name) = "KARAMCHEDU"'.

Error message: org.apache.openjpa.kernel.jpql.TokenMgrError: Lexical error at line 1, column 93. Encountered: "\"" (34), after : ""

[12/9/10 0:51:13:407 CST] 00000016 RegisteredSyn E WTRN0074E: Exception caught from after_completion synchronization operation: <openjpa-1.2.3-SNAPSHOT-r422266:965640 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: null

i tried mapping like this

@OneToMany(cascade ={CascadeType.ALL})
@JoinTable
(
name="ROOM_ROOMCONFIGURATION",
joinColumns={ @JoinColumn(name="ROOM_ID", referencedColumnName="ROOM_ID") },
inverseJoinColumns={ @JoinColumn(name="ROOMCONFIGURATIONS_ID", referencedColumnName="ROOMCONFIGURATIONS_ID") }
)


@OneToMany(cascade ={CascadeType.ALL})
@AssociationTable(
table=@Table(name=” ROOM_ROOMCONFIGURATION”),
joinColumns=
@JoinColumn(name=" ROOM_ID ", referencedColumnName=" ROOM_ID "),
inverseJoinColumns=
@JoinColumn(name=" ROOMCONFIGURATIONS_ID ", referencedColumnName=" ROOMCONFIGURATIONS_ID ")
)

please give me is there any differece in toplink and openJPA mappings ?

having any dependecies on servers?

can you suggest me to do changes in my application.

Thank in advance,
Rajesh Yarlagadda
Oliver Chua
Greenhorn

Joined: Feb 27, 2004
Posts: 29
Hi,


An error occurred while parsing the query filter 'SELECT o FROM LocState o where o.deleted = false and o.country.id = 88 AND UPPER(o.name) = "KARAMCHEDU"'.
Error message: org.apache.openjpa.kernel.jpql.TokenMgrError: Lexical error at line 1, column 93. Encountered: "\"" (34), after : ""

These two lines seem to suggest there's something wrong with the JPQL.
Shouldn't you be using single quotes instead of double quotes?
SELECT o FROM LocState o where o.deleted = false and o.country.id = 88 AND UPPER(o.name) = 'KARAMCHEDU'
rajesh babu Y
Ranch Hand

Joined: Nov 12, 2010
Posts: 31
hi ,

i tried with single quotes, but it was throwing me same exception.

is there any differences in mappings between toplink on Glassfish and OpenJPA on WAS7?

can you suggest what are the changes i do when i am moving from toplink in glassfish to OpenJPA in WAS7?

is OpenJPA is default for WAS7 or need any configurations in WAS7?

Thanks in Advance,
Rajesh Yarlagadda


Oliver Chua
Greenhorn

Joined: Feb 27, 2004
Posts: 29
It may be that the server is caching. Try restarting your server and redeploying.
It shouldn't give you that same error if you've already fixed the JPQL.

Sorry, I haven't used OpenJPA or WAS7 to be able to help you with your question.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: solution for EJB3.0 and Open JPA in WAS7