OpenJPA reconnect derby database issue.

2009-06-05 Thread wang yu
Hello, My application uses Tomcat6,derby,spring and OpenJPA 1.20. My case is stopping derby database and restarting it. And I found even if I catch the database connection broken exception and create an new EntityManager successfully after derby restarts, the following exception stack will be print

Re: mapping tool / enums /trunk

2009-06-05 Thread Frank Schwarz
I've just created https://issues.apache.org/jira/browse/OPENJPA-1121 -- Frank -- View this message in context: http://n2.nabble.com/mapping-tool---enums--trunk-tp2138657p3029696.html Sent from the OpenJPA Users mailing list archive at Nabble.com.

SqlResultSetMapping hierarchy

2009-06-05 Thread Daryl Stultz
Hello, I'm not the first to ask this but I didn't find an answer. Is it possible for SqlResultSetMapping / NativeQuery to construct an object hierarchy, for example to return entities A and B where B is a child of A? A1 B1 B2 A2 B3 B4 ...etc. Thanks. -- Daryl Stultz _

Code organization

2009-06-05 Thread Daryl Stultz
Hello, I'm frustrated by the fact that I need to define @NamedQuery and others inside my entity classes. I would like to put what I consider "logic" where I think it's appropriate which is often not with the model. Is there a way to programmatically define Named Queries Sql Result Set Mappings, et

Re: OpenJPA reconnect derby database issue.

2009-06-05 Thread Michael Dick
Hi Yu Wang, It sounds like someone is maintaining a pool of EntityManagers. The assertOpen method isn't checking Derby, it's concerned with the state of the EntityManager itself. How did you close the cache of OpenJPA EntityManagers? I have very little experience with Spring, but the stack makes

Re: Code organization

2009-06-05 Thread Pinaki Poddar
Hi Daryl, This is one feature, for a long time, I am interested to be included in JPA or at least in OpenJPA. Having your queries *only* in the major compilation unit is a poor idea for usability point of view and takes away much of the power from tuning a query a posteriori. However, I had con

Re: Code organization

2009-06-05 Thread Daryl Stultz
On Fri, Jun 5, 2009 at 11:33 AM, Pinaki Poddar wrote: > > > However, I had considered the facility slightly differently than yours. Naturally, since you're a JPA expert and I'm just a lowly beginner... I was just putting out a "sketch" to help folks understand what I was after. > > The primar

Re: Using jpql IN over element collections

2009-06-05 Thread catalina wei
Hi Luis, Sorry, the re-written query string : "and (r = :a or r = :u)" that I suggested is incorrect in syntax. The bottom line is that "r" that ranges over an element collection is not a valid state_field_path_expression that appears as an operand in comparison expressions. Catalina On Wed, Jun

Re: Code organization

2009-06-05 Thread Donald Woods
Pinaki Poddar wrote: Hi Daryl, This is one feature, for a long time, I am interested to be included in JPA or at least in OpenJPA. Having your queries *only* in the major compilation unit is a poor idea for usability point of view and takes away much of the power from tuning a query a posterio

Re: Code organization

2009-06-05 Thread Michael Dick
Alternatively you could just include a MappedSuperclass that holds the query annotations in your persistence context. No need for a property, but you have to make sure the MappedSuperclass is part of the PersistenceUnit (add to classes in persistence.xml, specify via openjpa.MetaDataFactory=jpa(Typ

Re: Code organization

2009-06-05 Thread Daryl Stultz
On Fri, Jun 5, 2009 at 3:51 PM, Michael Dick wrote: > Maybe I'm misunderstanding the use case, but the real coupling is the named > queries to persistence.xml (persistence unit) - not necessarily the > compilable unit. This is the case for me. In my pre-JPA world I have a Widget model class and

Re: Code organization

2009-06-05 Thread David Beer
Hi All I too would much rather see @NamedQuery(ies) defined in a seperate class like I do other more complicated queries. I also see this as a good way of keeping things modular or decoupled from the model. Using a seperate java class which then registers those queries at run time would be a good

Re: Code organization

2009-06-05 Thread Michael Dick
On Fri, Jun 5, 2009 at 3:12 PM, Daryl Stultz wrote: > On Fri, Jun 5, 2009 at 3:51 PM, Michael Dick >wrote: > > > Maybe I'm misunderstanding the use case, but the real coupling is the > named > > queries to persistence.xml (persistence unit) - not necessarily the > > compilable unit. > > > This i

Re: Code organization

2009-06-05 Thread Michael Dick
On Fri, Jun 5, 2009 at 3:25 PM, David Beer wrote: > Hi All > > I too would much rather see @NamedQuery(ies) defined in a seperate > class like I do other more complicated queries. I also see this as a > good way of keeping things modular or decoupled from the model. > > Using a seperate java class

Re: Code organization

2009-06-05 Thread Pinaki Poddar
Hi Daryl, Actually, there is an way you can externalize your queries from your Java code. orm.xml has a 'global' named-query clause. 1. put you JPQL query string there. 2. If you do not want to write your POJO entities in orm.xml, that is OK. 3. specify orm.xml in clause in persistenc

how isDetached(object) works?

2009-06-05 Thread Anurag Rai
Hi , I want to understand why isDetached is using find. I thought it would be as simple as reading a boolean variable which is set if detach is caaled on that particular entity. Furthermore i am not getting the comment below: // not a part of Query result load. Look into the slices til