geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Woods <dwo...@apache.org>
Subject Re: Problems with Geronimos openjpa on foreign keys
Date Tue, 18 Nov 2008 18:28:54 GMT
I believe this is known problem in the OpenJPA 1.0.3 level we used in 
the 2.0.* and 2.1.* releases.  Can you try a recent 2.1.4-SNAPSHOT build 
(such as the one below) to see if OpenJPA 1.2.0 fixes this?


Subject: [BUILD] branches/2.1: Successful
Date: 18 Nov 2008 17:11:08 -0000
Geronimo Revision: 718564 built with tests included
See the full build-0800.log file at 
http://people.apache.org/builds/geronimo/server/binaries/2.1/20081118/build-0800.log
Download the binaries from 
http://people.apache.org/builds/geronimo/server/binaries/2.1/20081118


-Donald


jsmch wrote:
> Hallo one again,
> 
> i´ve problems with foreign-key-crossreferences using geronimo.
> 
> I try using a Query 
> 	Query q = em.createQuery("SELECT u FROM ChatUserLoggedIn u where
> u.chatroomid = 		null");
> 	List resultList = q.getResultList();
> 	List<ChatUserLoggedIn> list = resultList;
> 	return list; 
> 
> My entities look like this:
> ======================================
> @Entity
> public class ChatUserLoggedIn implements Serializable {
> 	
> 	@Id
> 	@GeneratedValue(strategy = GenerationType.AUTO)
> 	private int id;
> 
> 	@ManyToOne
> 	@JoinColumn(name="userid")
> 	private ChatUser user;
> 
> 	@ManyToOne	
> 	@JoinColumn(name="chatroomid", nullable=true)
> 	private ChatRoom room;
> 
> 	private static final long serialVersionUID = 1L;
> ======================================
> @Entity
> public class ChatUser implements Serializable{
> 	private static final long serialVersionUID = 1L;
> 	
> 	@Id
> 	@GeneratedValue(strategy = GenerationType.AUTO)
> 	private int id;
> 	
> 	@Column(length=20)
> 	private String username;
> 	
> 	@Column(length=20)
> 	private String password;
> 	@Temporal(TemporalType.TIMESTAMP)
> 	Date date;
> 	Date login;
> 	
> 	@ManyToOne
> 	@JoinColumn(name="roleid")
> 	private Role role;
> 	
> 	@OneToMany(mappedBy="user", cascade=CascadeType.REMOVE)
> 	private  List<ChatUserLoggedIn> chatuserloggedin;
> ========================================
> Therefore the database was fields id, userid and chatroomid in the
> chatuserloggedintable.
> But the result in executing this query is:
> ------------------------------------------------
> 11:41:27,937 OFF   [standard]
> -----------------------------------------------------------------------------------------
> <openjpa-1.0.3-r420667:677674 nonfatal user error>
> org.apache.openjpa.persistence.ArgumentException: An error occurred while
> parsing the query filter "SELECT u FROM ChatUserLoggedIn u where
> u.chatroomid = null". Error message: No field named "chatroomid" in class
> "class chat.entities.ChatUserLoggedIn".
> 	at
> org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(AbstractExpressionBuilder.java:118)
> 	at
> org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.traversePath(AbstractExpressionBuilder.java:284)
> 	at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getPath(JPQLExpressionBuilder.java:1313)
> 	at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getPathOrConstant(JPQLExpressionBuilder.java:1268)
> 	at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.eval(JPQLExpressionBuilder.java:866)
> 	at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getValue(JPQLExpressionBuilder.java:1362)
> 	at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getValue(JPQLExpressionBuilder.java:1348)
> 	at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.eval(JPQLExpressionBuilder.java:759)
> 	at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getExpression(JPQLExpressionBuilder.java:1339)
> 	at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.eval(JPQLExpressionBuilder.java:709)
> 	at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.evalWhereClause(JPQLExpressionBuilder.java:484)
> 	at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getQueryExpressions(JPQLExpressionBuilder.java:264)
> 	at org.apache.openjpa.kernel.jpql.JPQLParser.eval(JPQLParser.java:61)
> 	at
> org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor.<init>(ExpressionStoreQuery.java:656)
> 	at
> org.apache.openjpa.kernel.ExpressionStoreQuery.newDataStoreExecutor(ExpressionStoreQuery.java:165)
> 	at org.apache.openjpa.kernel.QueryImpl.createExecutor(QueryImpl.java:728)
> 	at
> org.apache.openjpa.kernel.QueryImpl.compileForDataStore(QueryImpl.java:686)
> 	at
> org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:668)
> 	at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1487)
> 	at
> org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:123)
> 	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:227)
> 	at
> org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:277)
> 	at
> chat.entities.access.DataAccessService.getOnlineUser(DataAccessService.java:558)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> 	at java.lang.reflect.Method.invoke(Unknown Source)
> 	at
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:158)
> 	at
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:141)
> 	at
> org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:67)
> 	at
> org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:210)
> 	at
> org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:188)
> 	at
> org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:165)
> 	at
> org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:217)
> 	at
> org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:77)
> 	at
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:321)
> 	at
> org.apache.openejb.util.proxy.Jdk13InvocationHandler.invoke(Jdk13InvocationHandler.java:49)
> 	at $Proxy62.getOnlineUser(Unknown Source)
> 	at chat.kernel.impl.Client.isUserOnline(Client.java:275)
> 	at chat.kernel.impl.Client.login(Client.java:85)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> 	at java.lang.reflect.Method.invoke(Unknown Source)
> 	at
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:158)
> 	at
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:141)
> 	at
> org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:67)
> 	at
> org.apache.openejb.core.stateful.StatefulContainer._invoke(StatefulContainer.java:451)
> 	at
> org.apache.openejb.core.stateful.StatefulContainer.businessMethod(StatefulContainer.java:413)
> 	at
> org.apache.openejb.core.stateful.StatefulContainer.invoke(StatefulContainer.java:271)
> 	at
> org.apache.openejb.server.ejbd.EjbRequestHandler.doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java:238)
> 	at
> org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:129)
> 	at
> org.apache.openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:164)
> 	at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:122)
> 	at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:84)
> 	at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:60)
> 	at org.apache.openejb.server.ServicePool$2.run(ServicePool.java:78)
> 	at org.apache.openejb.server.ServicePool$3.run(ServicePool.java:101)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
> 	at java.lang.Thread.run(Unknown Source)
> ------------------------------------------------
>  
> Perhaps there are problems with persistence.xml? It looks like this:
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
> 	<persistence-unit name="chat" transaction-type="JTA">
> 		<description>ContainerManagedJPA</description>
> 	
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> 		<jta-data-source>mySQLDatabasePool</jta-data-source>
> 		<non-jta-data-source>mySQLDatabasePool</non-jta-data-source>
> 		<class>chat.entities.Role</class>
> 		<class>chat.entities.ChatUserLoggedIn</class>
> 		<class>chat.entities.ChatUser</class>
> 		<class>chat.entities.ChatRoom</class>
> 		<class>chat.entities.Category</class>
> 		<properties>
> 			<property name="openjpa.jdbc.SynchronizeMappings"
> value="buildSchema(ForeignKeys=true)" />
> 			</properties> ...
> 
> Any idea?
> 
> P.S.: Simple Queries on chatuser-table with selecting on name are no
> problem. I´m also able to add new records to the database - but this
> foreign-key-thing did not work yet (but with this configuration it already
> worked under JBoss- this was the original app-environment...)
> 

Mime
View raw message