Multithreading problem

2011-09-28 Thread Tuomas Hynninen
Hi! I've been getting this error randomly: org.apache.openjpa.util.InternalException: Multiple concurrent threads attempted to access a single broker. By default brokers are not thread safe; if you require and/or intend a broker to be accessed by more than one thread, set the openjpa.Multith

Re: OpenJPA querying on element collections

2011-09-28 Thread Howard Mak
KEY was exactly what I was looking for. Thanks! - Howard - Reply message - From: "Rick Curtis" To: "users@openjpa.apache.org" Subject: OpenJPA querying on element collections Date: Tue, Sep 27, 2011 8:35 am Howard - Yes, it is possible. I'd recommend reading through the JPA 2.0 spec

Re: Multithreading problem

2011-09-28 Thread Rick Curtis
> Some persisted entities are shared between threads, but not EntityManagers. This is the root of your problem. EntityManagers and Entities can't be shared across threads. Thanks, Rick Section 7.2 -- JPA 2.0 Spec An entity manager must not be shared among multiple concurrently executing threads,

Re: How to Enable Buildtime entity enhancement in RSA?

2011-09-28 Thread Kevin Sutter
Hi, You have been referencing "code", but I haven't seen any code attachments or code snippets to look at... A good reference for OpenJPA's enhancement processing can be found on our wiki: http://openjpa.apache.org/entity-enhancement.html You are correct. There are hooks in the WebSphere code to

Re: Multithreading problem

2011-09-28 Thread Pinaki Poddar
Concurrent threads can operate on an OpenJPA EntityManager. However, by default, EntityManager is not thread-safe. Try Please note that this flag will ensure that OpenJPA will protect all its internal data structures for concurrent access. But the persistent entities being operated upon are in u

Re: problems running JPA standalone (outside of container)

2011-09-28 Thread Pinaki Poddar
> Does OpenJPA really support standalone usage? Yes. > org.xml.sax.SAXNotRecognizedException: > http://java.sun.com/xml/jaxp/properties/schemaLanguage Most likely the problem lies with XML parsers available in your environment. 1. How are you invoking the standalone program? 2. What SAXParser is

Re: Multithreading problem

2011-09-28 Thread Rick Curtis
> Be careful when setting this property as there is at least one known bug[1]. Thanks, Rick [1] https://issues.apache.org/jira/browse/OPENJPA-1716 On Wed, Sep 28, 2011 at 9:01 AM, Pinaki Poddar wrote: > Concurrent threads can operate on an OpenJPA EntityManager. However, by > default, Entity

Re: problems running JPA standalone (outside of container)

2011-09-28 Thread James Barnett
Here's the code I'm using -- it's about as basic as it gets public static void main(String[] args) { EntityManager em = null; EntityManagerFactory factory = null; try { factory = Persistence. createEntityManagerFactory("event

Re: problems running JPA standalone (outside of container)

2011-09-28 Thread Pinaki Poddar
> gnu.xml.aelfred2.JAXPFactory This is the most likely cause of the problem. This SAX parser is not part of standard Java runtime libraries, afaik. So I am assuming that the execution classpath have explicitly included this library. I would suggest you remove this library from classpath. Java runt

Re: problems running JPA standalone (outside of container)

2011-09-28 Thread James Barnett
OK, thanks. But, now the original problem appears again SAX Parser class ---> org.apache.xerces.jaxp.SAXParserFactoryImpl javax.persistence.PersistenceException: Explicit persistence provider error(s) occurred for "event" after trying the following discovered implementations: org.apache.openjp

Re: problems running JPA standalone (outside of container)

2011-09-28 Thread Pinaki Poddar
Oops, Please do this to see which parser is active SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser parser = factory.newSAXParser(); System.err.println("Factory: " + factory.getClass().getName()); System.err.printl

RE: problems running JPA standalone (outside of container)

2011-09-28 Thread James Barnett
Here's the output: Factory: org.apache.xerces.jaxp.SAXParserFactoryImpl Parser: org.apache.xerces.jaxp.SAXParserImpl Thanks for your help... From: Pinaki Poddar [via OpenJPA] [mailto:ml-node+s208410n6840929...@n2.nabble.com] Sent: Wednesday, September 28, 2011 10:44 AM To: Barnett, James Subje

Re: How to Enable Buildtime entity enhancement in RSA?

2011-09-28 Thread chintan4181
Hi kevin, Attached POJO:-- http://openjpa.208410.n2.nabble.com/file/n6841060/BranchVO.java BranchVO.java Code snippet to retrieve values //native sql query String njSql = "SELECT b.branch_id, b.branch_cust_id, ba.branch_address_street1 from branch as b," + "branc

RE: problems running JPA standalone (outside of container)

2011-09-28 Thread Pinaki Poddar
We are in difficult territory now. The error shows that the SAXParser does not recognize a property that OpenJPA is attempting to set before using the parser. Now, I ran a small test and my SAXFactory/Parser are same as yours. I am using JDK 1.5. Please run the following code (preferably from a

Re: problems running JPA standalone (outside of container)

2011-09-28 Thread Kevin Sutter
I'm going to throw this one out as a wild hair... What JDK is being used? I notice the user's id is from HP and I believe HP has a special version of the JDK. If, by chance, you are using the special HP JDK, can you try the scenario with a standard Sun/Oracle JDK? Like I said, just a wild guess

RE: problems running JPA standalone (outside of container)

2011-09-28 Thread James Barnett
Hi -- my environ: - jdk 1.6. 0_22 (Sun/Oracle JDK) - Using Eclipse "Run as Java Application" Results of 'testParserProperty' invocation: class org.apache.xerces.jaxp.SAXParserFactoryImpl class org.apache.xerces.jaxp.SAXParserImpl org.xml.sax.SAXNotRecognizedException: http://java.sun.com/xml/j

Re: How to Enable Buildtime entity enhancement in RSA?

2011-09-28 Thread Kevin Sutter
Hi, BranchVO is an Embeddable. The enhancement process should process @Entity, @MappedSuperClass, and @Embeddable POJOs. You mentioned earlier that you were using WebSphere. But, the code snippet below shows you manually creating the EMF and EM. So, I would guess that for this test case, you ar

RE: problems running JPA standalone (outside of container)

2011-09-28 Thread Pinaki Poddar
> Please run the following code (*preferably* from a command-line) I will change that *preferably* to a *must*. And ensure *nothing else* is in your classpath (other than the program itself :) As you can see that the problem can be reproduced even without OpenJPA. It is caused by the environmenta

RE: problems running JPA standalone (outside of container)

2011-09-28 Thread James Barnett
No problem and thanks a lot! Running standalone worked -- I will figure out the conflict. Thanks for your time & patience... From: Pinaki Poddar [via OpenJPA] [mailto:ml-node+s208410n6841367...@n2.nabble.com] Sent: Wednesday, September 28, 2011 12:36 PM To: Barnett, James Subject: RE: problems

What is pcVersionInit?

2011-09-28 Thread kostellodon
Not a true problem I don't think, but a curiosity. I am using the version of JPA 1.2.3-SNAPSHOT which is included in WebSphere 7. I have a base class that contains common fields, such as id, insert user, insert datetime, etc, and this is annotated as @MappedSuperclass. My entities all extend thi

Re: Problems getting the old state of a Map / auditing

2011-09-28 Thread Christopher Cudennec
I see. I'm looking forward to the next release then! :) Am 22.09.2011 18:39, schrieb Pinaki Poddar: Hi Christopher, The "old" value is not available *externally* via SaveFieldManager. That is why all that work gone in writing an Auditor, as I had mentioned earlier. - Pinaki Poddar Chai

Re: How to Enable Buildtime entity enhancement in RSA?

2011-09-28 Thread chintan4181
Sorry. It was my mistake. I was trying different scenairos. I forgot to remove @Embeddable annotation. If i use embeddable, I am getting below exception org.apache.openjpa.persistence.InvalidStateException: Cannot instantiate virtual mapping "com.company.vo.BranchVO". I am running application o

Re: Problems getting the old state of a Map / auditing

2011-09-28 Thread Pinaki Poddar
> I'm looking forward to the next release then! :) Following Linus' Law (""given enough eyeballs, all bugs are shallow"), if more people test it out, then OpenJPA will have a "bug-free" release. I was hoping that so much interest in Auditing (a mail chain with 60+ replies) will make some people

Re: How to Enable Buildtime entity enhancement in RSA?

2011-09-28 Thread Kevin Sutter
Hi, Your posts are going all over the map... It looks like you are attempting to track several different issues and the details are getting muddled... Since you are using WebSphere, have you considered using the PMR process to track this problem? You might get a more dedicated response... If yo

Re: How to Enable Buildtime entity enhancement in RSA?

2011-09-28 Thread chintan4181
Sure Kevin. Let me create new post with all details. Thanks unmarshall -- View this message in context: http://openjpa.208410.n2.nabble.com/How-to-Enable-Buildtime-entity-enhancement-in-RSA-tp6836583p6841828.html Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: What is pcVersionInit?

2011-09-28 Thread Kevin Sutter
This is interesting. I thought FindBugs ran against the java source, not the class files. The pcVersionInit field that you reference is a field that is inserted into the bytecodes of an Entity class file during the OpenJPA enhancement processing. (FYI, any fields or methods that are prefaced by

Re: What is pcVersionInit?

2011-09-28 Thread Rick Curtis
> Just for my own curiosity, where can I find out what pcVersionInit is? pcVersionInit was added with OPENJPA-1400[1]. Thanks, Rick [1] https://issues.apache.org/jira/browse/OPENJPA-1400 On Wed, Sep 28, 2011 at 3:18 PM, kostellodon wrote: > Not a true problem I don't think, but a curiosity. > >

Retrieving POJO using Native Query

2011-09-28 Thread chintan4181
Hi, We have different business departments and each of these departments have their own persistent units. Since departments are dynamic, we have thought of using application-mangaged entity manager based on the persistent unit passed for respective business unit. We are creating map of emf for pe

Re: What is pcVersionInit?

2011-09-28 Thread kostellodon
FindBugs runs against the class files. We are running this from Jenkins, and are using Maven to do the build. So, we've got Maven set up to do compile-time enhancement. To check against unenhanced classes, we'd have to do something like creating two different builds using different Maven profile

Re: Retrieving POJO using Native Query

2011-09-28 Thread chintan4181
We have this common code becuase we dont know entity defined in the persistence.xml belongs to which persistent unit. so iterate over entity managers to find out. Once we find out we assign entity manager and then interact with db with that em. //em1 we got it from emf map Set> em1En