Re: [VOTE] Release Apache OpenJPA-2.4.0

2015-04-20 Thread Kevin Sutter
Hi Mark,
Thanks for doing this release!

Question:  What about the manual and javadocs?  I saw your other notes
about some issues with building the docs, but I thought you had resolved
them.  And, I do like to verify javadocs for a release.  The rest of the
artifacts look good thus far!

Thanks,
Kevin

On Mon, Apr 20, 2015 at 4:30 AM, Romain Manni-Bucau rmannibu...@gmail.com
wrote:

 +1 (non binding)


 Romain Manni-Bucau
 @rmannibucau https://twitter.com/rmannibucau |  Blog
 http://rmannibucau.wordpress.com | Github 
 https://github.com/rmannibucau |
 LinkedIn https://www.linkedin.com/in/rmannibucau | Tomitriber
 http://www.tomitribe.com

 2015-04-19 17:03 GMT+02:00 Mark Struberg strub...@yahoo.de:

  It’s a great pleasure to call a VOTE for releasing Apache OpenJPA-2.4.0.
 
  OpenJPA-2.4.0 implements the JPA-2.0 specification.
 
  The staging repository can be found here:
 
 https://repository.apache.org/content/repositories/orgapacheopenjpa-1000/
 
  The Release Notes can be found in the file
  openjpa-project/RELEASE_NOTES.html and online under:
 
 
 https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310351version=12325298
 
  The SVN source TAG is (1674626):
  https://svn.apache.org/repos/asf/openjpa/tags/openjpa-parent-2.4.0/
 
  The source release can be found here:
 
 
 https://repository.apache.org/content/repositories/orgapacheopenjpa-1000/org/apache/openjpa/openjpa-parent/2.4.0/openjpa-parent-2.4.0-source-release.zip
 
  The binary release is here:
 
 
 https://repository.apache.org/content/repositories/orgapacheopenjpa-1000/org/apache/openjpa/apache-openjpa/2.4.0/apache-openjpa-2.4.0-binary.zip
 
  My Key can be found here
  https://svn.apache.org/repos/asf/openjpa/KEYS
 
 
  The VOTE will be open for 72 hours.
  [+1] approve
  [+0] meh, don’t care
  [-1] stop, I’ve found a ${fish} in there
 
 
  txs and LieGrue,
  your OpenJPA team



Re: OpenJPA PostgreSQL UUID column

2015-03-31 Thread Kevin Sutter
Hi Hal,
You said you've been googling this problem, so my suggestions might have
already been tried (and failed)...

The use of a ValueHandler sounds like the proper approach for supporting
the native UUID type.  OpenJPA provides a couple of ValueHandlers for
normal use and for test purposes.  Have you tried running the associated
junits to see how the current ValueHandlers are used?  That's how I would
debug this problem.  Look at the processing that currently works and then
compare that to the path that is not working.

Since ValueHandlers are verified by OpenJPA's test bucket, I would guess
there is some slight issue with your specific UuidValueHandler.  I took a
quick look, but nothing jumped out at me.  Other than your toDataStoreValue
and toObjectValue look a little light.  But, maybe you are just trying to
get the basic flow to work first?

Based on this exercise, if you find something that should be beefed up in
the OpenJPA test suite, please do offer to contribute your findings.

Thanks, Kevin

On Fri, Mar 27, 2015 at 6:28 PM, Hal Hildebrand hal.hildebr...@me.com
wrote:



 I’m trying to use the native UUID type for PostgreSQL in my OpenJPA
 model.  I’m using OpenJPA 2.3.0 and at the current level of the PostgreSQL
 JDBC driver.

 I’ve tried to accomplish this several times and I’ve gotten a bit further
 this time.  I created a ValueHolder (see attached file) and it does what I
 believe is the correct setup for this type.  I use this as the strategy for
 the column - i.e. :

 @Strategy(com.chiralbehaviors.CoRE.openjpa.UuidValueHandler)

 I’ve validated via breakpoint that the UuidValueHolder is indeed called in
 setup and when converting values.  I’m at the point of trying to do an
 insert, and regardless of whether I use an actual UUID as the return
 mapping (i.e. no transform) or a string (UUID.toString()) I get the same
 error:

 ERROR: column id is of type uuid but expression is of type bytea
   Hint: You will need to rewrite or cast the expression.
   Position: 93 {prepstmnt 1848199707
 INSERT INTO ruleform.agency (id, notes, update_date, description, name,
 updated_by)
 VALUES (?, ?, ?, ?, ?, ?)
 [params=(byte[]) [B@9ac8b5b, (null) null, (Timestamp) 2015-03-27
 15:20:05.921, (null) null, (String) CoRE, (byte[]) [B@15b17c95]} [code=0,
 state=42804]


 I believe that this error comes from the postgres jdbc driver, not
 openJPA.  I’ve even tried using PGObject, which surprisingly works just
 fine, but throws the same error.

 In my google searches, this has come across as a typical problem, and I’ve
 only found solutions for this (hypothesized) for Toplink and Hibernate.
 The one thing I could find suggested writing the ValueHolder and that does
 work up until the point I try to actually insert in JDBC land.

 Note that the UUID is being passed as a byte array.

 So my question is, am I doing anything incorrect?  Missing something?
 From the error message, it would appear postgresql wants me to cast the
 result, but I’m not sure how to accomplish that in OpenJPA.  It could
 simply be a red herring.

 Any help appreciated, as I simply can’t find a working solution via Der
 Google

 -Hal




Re: Commercial Support?

2015-02-28 Thread Kevin Sutter
And, of course, WebSphere Application Server provides commercial support
since OpenJPA provides the basis for the JPA solution in WAS.

On Thu, Feb 26, 2015 at 7:41 AM, Rick Curtis curti...@gmail.com wrote:

 Tomitribe[1] might provide commercial support.

 [1] http://www.tomitribe.com/

 On Thu, Feb 26, 2015 at 1:15 AM, Jörn Gersdorf jo...@gersdorf.info
 wrote:

  Hi all,
 
  are you aware of any company offering commercial support for OpenJPA?
  Google did not help me in that case.
 
  Thank you.
 
  Kind regards,
  Jörn
 



 --
 *Rick Curtis*



Re: OpenJPA and auto-commit

2014-12-01 Thread Kevin Sutter
Hi Charlie,
Since you are using SynchronizeMappings, you should be providing an
alternate datasource (non-jta-data-source) in addition to the
jta-data-source.  OpenJPA requires access to the database in order to
define or adjust your schemas based on your Entity definitions.  Without a
non-jta-data-source, OpenJPA will attempt to do this work within the global
transaction.  Unfortunately, the auto commit processing doesn't work well
within a global transaction (as you have found out).

Hope this helps.

Kevin

On Sun, Nov 30, 2014 at 9:05 AM, Charlie Mordant cmorda...@gmail.com
wrote:

 Hi OpenJPA Guru's,

 I'm encountering an issue when openJPA participates to a global
 transaction, I've got this weird error happening sometimes:

 Caused by: openjpa-2.3.0-r422266:1540826 nonfatal general error
 org.apache.openjpa.persistence.PersistenceException:
 setAutoCommit(true) invalid during global transaction.

 at
 org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:559)

 at
 org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)


 My persistence.xml is as simple as it can be:
 [code]

 persistence-unit name=${project.artifactId}Pu transaction-type=JTA


  providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider

 jta-data-sourceosgi:service/javax.sql.DataSource/(amp;(
 osgi.jndi.service.name
 =${project.parent.artifactId}.database)(aries.managed=true))/
 jta-data-source

 properties

  property name=openjpa.Log value=slf4j/

  property name=openjpa.jdbc.SynchronizeMappings value=
 buildSchema(ForeignKeys=true,SchemaAction=refresh)/

  property name=openjpa.jdbc.DBDictionary value=derby/

 /persistence-unit
 [/code]

 Is there any property/option to set somewhere?

 ​Regards,​

 --
 Charlie Mordant

 Full OSGI/EE stack made with Karaf:
 https://github.com/OsgiliathEnterprise/net.osgiliath.parent



Re: OpenJPA and auto-commit

2014-12-01 Thread Kevin Sutter
Hi Charlie,
Most of my experience is in the Java EE space, not the OSGi/Aries
environment.  Since WebSphere is using both Aries and OpenJPA, and
WebSphere supports both Java EE and OSGi programming models, you should be
able to get this combination to work.  I'm just not sure what, if any,
additional magic WebSphere had to include...  Have you been posting on the
Aries site as well?

Good luck,
Kevin

On Mon, Dec 1, 2014 at 3:53 PM, Charlie Mordant cmorda...@gmail.com wrote:

 Hi Kevin,

 I removed the non-jta-datasource (referencing the same connection) because
 I thought it was the issue (and that was failing the same way).
 Even if I add it, it also fails (randomly, sometimes it passes).

 I’m not sure it is really OpenJpa related, as I’m using Aries-JPA/Tx,
 Pax-JDBC.
 I’m currently investigating, and if you’ve any other pointers I’ll sure
 try :).

 Thank you, and best regards,

 Charlie

 PS: if you’re also interested in the case, you can also try to see where’s
 the catch compiling this:
 https://github.com/OsgiliathEnterprise/net.osgiliath.parent 
 https://github.com/OsgiliathEnterprise/net.osgiliath.parent (it will
 once on three times fail on the hello sample blueprint test).

  Le 1 déc. 2014 à 22:41, Kevin Sutter kwsut...@gmail.com a écrit :
 
  Hi Charlie,
  Since you are using SynchronizeMappings, you should be providing an
  alternate datasource (non-jta-data-source) in addition to the
  jta-data-source.  OpenJPA requires access to the database in order to
  define or adjust your schemas based on your Entity definitions.  Without
 a
  non-jta-data-source, OpenJPA will attempt to do this work within the
 global
  transaction.  Unfortunately, the auto commit processing doesn't work well
  within a global transaction (as you have found out).
 
  Hope this helps.
 
  Kevin
 
  On Sun, Nov 30, 2014 at 9:05 AM, Charlie Mordant cmorda...@gmail.com
  wrote:
 
  Hi OpenJPA Guru's,
 
  I'm encountering an issue when openJPA participates to a global
  transaction, I've got this weird error happening sometimes:
 
  Caused by: openjpa-2.3.0-r422266:1540826 nonfatal general error
  org.apache.openjpa.persistence.PersistenceException:
  setAutoCommit(true) invalid during global transaction.
 
 at
  org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:559)
 
 at
  org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
 
 
  My persistence.xml is as simple as it can be:
  [code]
 
  persistence-unit name=${project.artifactId}Pu transaction-type=JTA
 
 
 
 providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider
 
  jta-data-sourceosgi:service/javax.sql.DataSource/(amp;(
  osgi.jndi.service.name
  =${project.parent.artifactId}.database)(aries.managed=true))/
  jta-data-source
 
  properties
 
  property name=openjpa.Log value=slf4j/
 
  property name=openjpa.jdbc.SynchronizeMappings value=
  buildSchema(ForeignKeys=true,SchemaAction=refresh)/
 
  property name=openjpa.jdbc.DBDictionary value=derby/
 
  /persistence-unit
  [/code]
 
  Is there any property/option to set somewhere?
 
  ​Regards,​
 
  --
  Charlie Mordant
 
  Full OSGI/EE stack made with Karaf:
  https://github.com/OsgiliathEnterprise/net.osgiliath.parent
 




Re: OpenJPA support for JPA 2.1: when?

2014-10-23 Thread Kevin Sutter
Hi,
Thanks for the note and reviving this thread...  We are well aware of
TomEE's desire for JPA 2.1 support in OpenJPA.  It would be great to see
JPA 2.1 support in OpenJPA.  But, the community contributions in this arena
have been slim.  This string of notes is one such plea, but there have been
others on users and dev mailing lists as well.

Although it has been pointed out that the majority of the current committer
set is from IBM (that part is true), we would greatly appreciate and
welcome contributions from anybody.  I don't think opening up the
committership to anybody who requests is a viable or valid solution.  I
think establishing some expertise by contributing patches (code, test,
docs, etc) is a valid process for establishing committer karma.

I had started the JPA 2.1 activity by documenting the high-level steps for
development:
http://openjpa.apache.org/jpa-2.1-tasks.html

But, as you can see, it's been pretty dormant.  Everybody involved with
Apache projects have day jobs.  And, as a good friend of mine once
stated, open source is not free.  So, if the JPA 2.1 support is required
by the OpenJPA community, then it's time for action.  As many of you know,
the OpenJPA solution is a very solid, well performing implementation of the
JPA specification.  But, we will need additional input to make the
implementation of JPA 2.1 real.

Just telling it like it is...
Kevin

On Wed, Oct 22, 2014 at 4:51 PM, tibor17 tibordig...@apache.org wrote:

 Hello guys,

 It looks like the TomEE server with Java EE 7 is waiting for OpenJPA
 release
 supporting JPA 2.1.
 How far is OpenJPA with JPA 2.1 support.
 I appreciate. Thx,



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/OpenJPA-support-for-JPA-2-1-when-tp7584157p7587287.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: javax.persistence.EntityListeners is never called

2014-10-14 Thread Kevin Sutter
Hi,
Your p.xml didn't post correctly... I'm curious what the NONE setting is
for...

At this point, nothing else is jumping out at me...

Kevin

On Tue, Oct 14, 2014 at 4:30 AM, goues...@orange.fr wrote:

 Hi

 One of the classes seems to be parsed twice according to the trace:
 718 RCSDMWebServicesPU TRACE [main] openjpa.MetaData - Loading metadata
 for class com.**.*.ejbs.utils.MultiLangString under mode
 [META][QUERY].
 718 RCSDMWebServicesPU TRACE [main] openjpa.MetaData - Parsing class
 com.**.*.ejbs.utils.MultiLangString.
 718 RCSDMWebServicesPU TRACE [main] openjpa.MetaData - Parsing package
 com.**.*.ejbs.utils.MultiLangString.
 718 RCSDMWebServicesPU TRACE [main] openjpa.MetaData - Generating default
 metadata for type com.**.*.ejbs.utils.MultiLangString.
 718 RCSDMWebServicesPU TRACE [main] openjpa.MetaData - Using reflection
 for metadata generation.
 733 RCSDMWebServicesPU TRACE [main] openjpa.MetaData - Set
 persistence-capable superclass of
 com.**.*.ejbs.utils.MultiLangString to null.
 733 RCSDMWebServicesPU TRACE [main] openjpa.MetaData - Resolving embedded
 metadata for com.**.*.ejbs.utils.MultiLangString@2102741454.
 733 RCSDMWebServicesPU TRACE [main] openjpa.MetaData - Set
 persistence-capable superclass of
 com.**.*.ejbs.utils.MultiLangString to null.
 733 RCSDMWebServicesPU TRACE [main] openjpa.MetaData - Resolving metadata
 for com.**.*.ejbs.utils.MultiLangString@1784722346.
 733 RCSDMWebServicesPU TRACE [main] openjpa.MetaData - Resolving field
 com.**.*.ejbs.utils.multilangstr...@1784722346.id.
 733 RCSDMWebServicesPU TRACE [main] openjpa.MetaData - Resolving field
 com.**.*.ejbs.utils.multilangstr...@1784722346.lang.
 733 RCSDMWebServicesPU TRACE [main] openjpa.MetaData - Resolving field
 com.**.*.ejbs.utils.multilangstr...@1784722346.text.
 733 RCSDMWebServicesPU TRACE [main] openjpa.MetaData - Resolving field
 com.**.*.ejbs.utils.multilangstr...@2102741454.id.
 733 RCSDMWebServicesPU TRACE [main] openjpa.MetaData - Resolving field
 com.**.*.ejbs.utils.multilangstr...@2102741454.lang.
 733 RCSDMWebServicesPU TRACE [main] openjpa.MetaData - Resolving field
 com.**.*.ejbs.utils.multilangstr...@2102741454.text.

 com.**.*.ejbs.utils.MultiLangString uses the annotation
 @Embeddable.

 This is the only suspicious thing I've found in the trace.

 This is my persistence.xml file:

 ?xml version=1.0 encoding=UTF-8?





 org.apache.openjpa.persistence.PersistenceProviderImpl

 java:/*WebServicesDS
 com.**.*.ejbs.utils.MultiLangString
 NONE




























  Message du 14/10/14 00:14
  De : Kevin Sutter
  A : users@openjpa.apache.org, goues...@orange.fr
  Copie à :
  Objet : Re: javax.persistence.EntityListeners is never called
 
  Hi,
  The complete trace can be turned on via this property in your p.xml:
 
 
 
  Good luck,
  Kevin
 
  On Mon, Oct 13, 2014 at 1:01 PM,  wrote:
 
   Hi
  
   I use Apache OpenEJB 4.7.1 (probably OpenJPA 2.2 or 2.3). I have
 looked at
   the logs and I have already done my best to force the persistence of
 all
   entity classes including those Hibernate was able to discover alone,
 for
   example the class using @Embeddable. As I'm currently not at work, I
 can't
   post the persistence.xml but I'll do it tomorrow. What should I turn
 on to
   get some more trace? Thank you for your help.
  
  
  
  
Message du 13/10/14 19:07
De : Kevin Sutter
A : users@openjpa.apache.org, goues...@orange.fr
Copie à :
Objet : Re: javax.persistence.EntityListeners is never called
   
Hi,
EntityListeners should work just fine with OpenJPA. What version of
OpenJPA are you using? The basic support is documented here:
   
  
 http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#jpa_overview_pc_callbacks
   
Are there any other messages in the logs that indicate an issue?
 Have you
tried turning on Trace to ensure that normal persistence processing
 is
happening? Can you post your p.xml? Like I mentioned, this should all
just work. We'll need a bit more context to help figure out the
 problem.
   
Kevin
   
On Mon, Oct 13, 2014 at 10:56 AM, wrote:
   
 Hello

 I use javax.persistence.EntityListeners. The persistent classes of
 the
 entities are correctly added into persistence.xml. My test case
 works
 correctly with Hibernate and OpenJPA except that the annotated
 methods
 (with @PostLoad, @PreUpdate, @PrePersist and @PostRemove) are never
   called
 by OpenJPA whereas they are called by Hibernate. Am I missing
 anything
 obvious? Best regards.

   
  
 



Re: javax.persistence.EntityListeners is never called

2014-10-13 Thread Kevin Sutter
Hi,
EntityListeners should work just fine with OpenJPA.  What version of
OpenJPA are you using?  The basic support is documented here:
http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#jpa_overview_pc_callbacks

Are there any other messages in the logs that indicate an issue?  Have you
tried turning on Trace to ensure that normal persistence processing is
happening?  Can you post your p.xml?  Like I mentioned, this should all
just work.  We'll need a bit more context to help figure out the problem.

Kevin

On Mon, Oct 13, 2014 at 10:56 AM, goues...@orange.fr wrote:

 Hello

 I use javax.persistence.EntityListeners. The persistent classes of the
 entities are correctly added into persistence.xml. My test case works
 correctly with Hibernate and OpenJPA except that the annotated methods
 (with @PostLoad, @PreUpdate, @PrePersist and @PostRemove) are never called
 by OpenJPA whereas they are called by Hibernate. Am I missing anything
 obvious? Best regards.



Re: javax.persistence.EntityListeners is never called

2014-10-13 Thread Kevin Sutter
Hi,
The complete trace can be turned on via this property in your p.xml:

property name=openjpa.Log value=DefaultLevel=TRACE/

Good luck,
Kevin

On Mon, Oct 13, 2014 at 1:01 PM, goues...@orange.fr wrote:

 Hi

 I use Apache OpenEJB 4.7.1 (probably OpenJPA 2.2 or 2.3). I have looked at
 the logs and I have already done my best to force the persistence of all
 entity classes including those Hibernate was able to discover alone, for
 example the class using @Embeddable. As I'm currently not at work, I can't
 post the persistence.xml but I'll do it tomorrow. What should I turn on to
 get some more trace? Thank you for your help.




  Message du 13/10/14 19:07
  De : Kevin Sutter
  A : users@openjpa.apache.org, goues...@orange.fr
  Copie à :
  Objet : Re: javax.persistence.EntityListeners is never called
 
  Hi,
  EntityListeners should work just fine with OpenJPA. What version of
  OpenJPA are you using? The basic support is documented here:
 
 http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#jpa_overview_pc_callbacks
 
  Are there any other messages in the logs that indicate an issue? Have you
  tried turning on Trace to ensure that normal persistence processing is
  happening? Can you post your p.xml? Like I mentioned, this should all
  just work. We'll need a bit more context to help figure out the problem.
 
  Kevin
 
  On Mon, Oct 13, 2014 at 10:56 AM,  wrote:
 
   Hello
  
   I use javax.persistence.EntityListeners. The persistent classes of the
   entities are correctly added into persistence.xml. My test case works
   correctly with Hibernate and OpenJPA except that the annotated methods
   (with @PostLoad, @PreUpdate, @PrePersist and @PostRemove) are never
 called
   by OpenJPA whereas they are called by Hibernate. Am I missing anything
   obvious? Best regards.
  
 



Re: Moving from OpenJPA 2.0.1 to 2.3.0: fields not found

2014-10-07 Thread Kevin Sutter
Lionel,
I would suggest trying to turn on Trace, but there doesn't seem to be a lot
of tracing in this particular area of the code...  :-(  It still might be
worth a shot.  Maybe an earlier log entry might shed some light on why this
is going awry...

I'm going to suggest one quick change just to see if it makes a
difference.  It shouldn't, but I stumbled on this the first time I read
your code, so maybe the OpenJPA code is making the same mistake...

Instead of referencing a final String field for your mappedBy field, what
happens if you just insert the actual string?  For example, instead of...
mappedBy = CAService._domainFieldName,
do this...
mappedBy = domains,

I know it shouldn't make a difference, but it might isolate the source of
the error if this does work.

Thanks, Kevin

On Tue, Oct 7, 2014 at 10:49 AM, Lionel lsavouil...@axway.com wrote:

 Hello,

 First, thanks a lot for your answer. :)

 In the past, we were using an ant build the project so also to run the JPA
 enhancer but for a company strategy reason we are moving to a maven build
 process.
 And when I did it, we've seen that there is a maven plugin to do the JPA
 enhancer.
 So that's why :)

 I just put back the default PersistenceProviderImpl and sadly, I had the
 same result. :(

 providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider



 To try to isolate the issue and, tonight, we will just replace the JPA
 version inside the existing project (built with ant) just to validate that
 has really no link with the enhancement.

 I will also try to upgrade openJPA version one by one to be sure from which
 the error appears and give additionnal data tomorrow.



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/Moving-from-OpenJPA-2-0-1-to-2-3-0-fields-not-found-tp7587168p7587176.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Moving from OpenJPA 2.0.1 to 2.3.0: fields not found

2014-10-07 Thread Kevin Sutter
Lionel,
Related to my comment about the earlier messages in the log...  Have you
looked at the earlier messages?  Do you get any errors when doing the build
time enhancement?  Any errors when the Entities are first loaded into your
application?

Are you running OpenJPA as part of an Application Server, or as part of a
standalone Java SE application?

If the latter, any other OpenJPA properties getting set on the Java
invocation?

Just trying to figure out if there's some hiccup related to the enhancement
processing where some of the Entities in your project are getting enhanced,
while others are not.

Kevin

On Tue, Oct 7, 2014 at 5:43 PM, Kevin Sutter kwsut...@gmail.com wrote:

 Lionel,
 I would suggest trying to turn on Trace, but there doesn't seem to be a
 lot of tracing in this particular area of the code...  :-(  It still might
 be worth a shot.  Maybe an earlier log entry might shed some light on why
 this is going awry...

 I'm going to suggest one quick change just to see if it makes a
 difference.  It shouldn't, but I stumbled on this the first time I read
 your code, so maybe the OpenJPA code is making the same mistake...

 Instead of referencing a final String field for your mappedBy field, what
 happens if you just insert the actual string?  For example, instead of...
 mappedBy = CAService._domainFieldName,
 do this...
 mappedBy = domains,

 I know it shouldn't make a difference, but it might isolate the source of
 the error if this does work.

 Thanks, Kevin

 On Tue, Oct 7, 2014 at 10:49 AM, Lionel lsavouil...@axway.com wrote:

 Hello,

 First, thanks a lot for your answer. :)

 In the past, we were using an ant build the project so also to run the JPA
 enhancer but for a company strategy reason we are moving to a maven build
 process.
 And when I did it, we've seen that there is a maven plugin to do the JPA
 enhancer.
 So that's why :)

 I just put back the default PersistenceProviderImpl and sadly, I had the
 same result. :(


 providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider



 To try to isolate the issue and, tonight, we will just replace the JPA
 version inside the existing project (built with ant) just to validate that
 has really no link with the enhancement.

 I will also try to upgrade openJPA version one by one to be sure from
 which
 the error appears and give additionnal data tomorrow.



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/Moving-from-OpenJPA-2-0-1-to-2-3-0-fields-not-found-tp7587168p7587176.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.





Re: Moving from OpenJPA 2.0.1 to 2.3.0: fields not found

2014-10-06 Thread Kevin Sutter
Lionel,
Nothing is jumping out at me, but I do have a couple of observations and
questions...

  I had a working project using OpenJPA 2.0.1
  We had to change the project to a maven build so we are now enhancing the
  classes this way:

How did you perform entity enhancement in 2.0.1?  Why did moving to Maven
require a change in the method of entity enhancement?


providercom.axway.passport.persistence.providers.jpa.PassportPersistenceProvider/provider

What is this?  You must be extending OpenJPA in some manner...  Have you
tried specifying the OpenJPA provider or just removing this element?

Maybe the answers to these questions will shed more light for me or others
to help with this question.

Kevin



On Fri, Oct 3, 2014 at 3:52 AM, Lionel lsavouil...@axway.com wrote:

 Hello,

 I had a working project using OpenJPA 2.0.1
 We had to change the project to a maven build so we are now enhancing the
 classes this way:
 plugin
 groupIdorg.apache.openjpa/groupId
 artifactIdopenjpa-maven-plugin/artifactId
 version2.3.0/version
 configuration


 persistenceXmlFile${project.basedir}/src/main/configuration/META-INF/persistence.xml/persistenceXmlFile
 addDefaultConstructortrue/addDefaultConstructor

 enforcePropertyRestrictionstrue/enforcePropertyRestrictions
 /configuration
 executions
 execution
 idenhancer/id
 phaseprocess-classes/phase
 goals
 goalenhance/goal
 /goals
 /execution
 /executions
 dependencies
 dependency
 groupIdorg.apache.openjpa/groupId
 artifactIdopenjpa/artifactId
 version2.3.0/version
 /dependency
 /dependencies
 /plugin

 The problem occurs at runtime during the commit for classes that have
 inheritance:
 openjpa-2.3.0-r422266:1540826 fatal general error
 org.apache.openjpa.persistence.PersistenceException: The transaction has
 been rolled back.  See the nested exceptions for details on the errors that
 occurred.
 at

 org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2370)
 at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2207)
 at
 org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:2105)
 at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1876)
 at
 org.apache.openjpa.kernel.QueryImpl.isInMemory(QueryImpl.java:973)
 at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:853)
 at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:794)
 at
 org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542)
 at
 org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:275)
 at
 org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:291)
 at

 com.axway.passport.schema.AbstractObject.getByPrimaryKey(AbstractObject.java:323)
 at

 com.axway.passport.schema.common.Organization.getOrganization(Organization.java:715)
 at

 com.axway.passport.upgrade.am.DataInitializer.createDefaultOrganizations(DataInitializer.java:138)
 at

 com.axway.passport.upgrade.am.DataInitializer.execute(DataInitializer.java:334)
 at

 com.axway.passport.persistence.upgrade.DataInitExecuter.executeInit(DataInitExecuter.java:80)
 at

 com.axway.passport.persistence.upgrade.SchemaInstaller.initData(SchemaInstaller.java:205)
 at

 com.axway.passport.persistence.upgrade.SchemaInstaller.installSchema(SchemaInstaller.java:101)
 at

 com.axway.passport.persistence.upgrade.SchemaInstaller.installSchema(SchemaInstaller.java:71)
 at

 com.axway.passport.service.PassportStartupThread.startCoreServices(PassportStartupThread.java:124)
 at

 com.axway.passport.service.PassportStartupThread.primRun(PassportStartupThread.java:84)
 at com.axway.passport.util.EventedThread.run(EventedThread.java:66)
 Caused by: openjpa-2.3.0-r422266:1540826 fatal user error
 org.apache.openjpa.persistence.ArgumentException:
 com.axway.passport.schema.pki.Entity.certificateAliases declared that it
 is mapped by parent, but that is a not a field of the related type.
 at

 org.apache.openjpa.meta.FieldMetaData.getMappedByMetaData(FieldMetaData.java:867)
 at

 org.apache.openjpa.jdbc.meta.strats.RelationFieldStrategy.getMapField(RelationFieldStrategy.java:341)
 at

 org.apache.openjpa.jdbc.meta.strats.RelationFieldStrategy.setMapKey(RelationFieldStrategy.java:304)
 at

 org.apache.openjpa.jdbc.meta.strats.RelationFieldStrategy.insert(RelationFieldStrategy.java:294)
 at
 

Re: Options for entity enhancement not working in maven build

2014-08-12 Thread Kevin Sutter
Hi Christian,
If I read your post correctly, the enhancement processing itself is working
via the maven plugin.  But, the specific openjpa property
(openjpa.DetachState) does not seem to be taking effect.  Is that an
accurate summary?  Before I comment further, I just want to ensure that I
understand the specific question.  Thanks.

Kevin


On Tue, Aug 12, 2014 at 10:18 AM, Christian Mötzing 
christian.moetz...@novatec-gmbh.de wrote:



 Hello OpenJPA mailing list.




 I hope I did not double post now. The page
 http://openjpa.apache.org/mailing-lists.html mentions I can post messages
 and does not mention any access restrictions (like being subscribed).

 I did not receive any feedback on my first mail (I was not subscribed) and
 it did not show in the feed etc. so I figured I need to subscribe to the
 list. Maybe some words on that on that page would be great.




 Now to my actual topic:



 I have the following configuration in my persistence.xml:



 persistence-unit name=my.pu

 providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider

 classcom.company.project.entities.Entity/class

 properties

 property name=openjpa.DetachState
 value=loaded(DetachedStateField=true)/

 /properties

 /persistence-unit



 My project can be built with Eclipse using runtime enhancement afterwards
 (via OpenJPA agent) to execute some tests. In this case enhancement uses
 the option above and does not insert transient fields on enhancement.

 I also have a maven build utilizing openjpa-maven-plugin
 (groupIdorg.apache.openjpa/groupIdartifactIdopenjpa-maven-plugin/artifactId).



 Plugin configuration looks like this:



 executions

 execution

 idenhancer/id

 phaseprocess-classes/phase

 goals

 goalenhance/goal

 /goals

 configuration

 includes**/entities /*.class/includes

 addDefaultConstructorfalse/addDefaultConstructor

 skip${openjpa.enhance.skip}/skip

 toolProperties

 property

 nameopenjpa.DetachState/name

 valueloaded(DetachedStateField=true)/value

 /property

 /toolProperties

 /configuration

 /execution

 /executions



 With or without toolProperties-tag entity enhancement does not use the
 option (neither through persistence.xml nor through pom.xml). Can you
 please point me to some documentation on how to set this option with
 openjpa-maven-plugin?




 This page
 http://openjpa.apache.org/builds/2.2.1/apache-openjpa/docs/ref_guide_conf_openjpa.html#openjpa.DetachState
 mentions a Resource adapter config-property for each entry. But there is
 no hint in the docs on what a  Resource adapter is in an OpenJPA context
 nor where I can set it.




 I am using OpenJPA 2.2.1.




 With kind regards


 Christian Mötzing
 Consultant

 NOVA TEC // Consulting GmbH
 Dieselstrasse 18/1 // D-70771 Leinfelden-Echterdingen



 phone:

 +49 711 22040-718


 fax:

 +49 711 22040-899


 mobile:

 +49 1608806281


 e-mail:

 christian.moetz...@novatec-gmbh.de


 web:

 www.novatec-gmbh.de



 Sitz der Gesellschaft: Waldenbuch // Handelsregister: Stuttgart – HRB
 739078
 Geschäftsführer: Hans-Dieter Brenner // Michael Schuchart // Albrecht
 Stäbler



Re: MariaDB vs. MySQL

2014-07-29 Thread Kevin Sutter
Marc,
What jdbc drivers are you using with each database type?  And, are you
letting OpenJPA determine the DBDictionary to use or are you explicitly
declaring it in your persistence.xml?  What version of OpenJPA are you
using?

The MariaDBDictionary is an almost identical copy of the
MySQLDBDictionary.   Just to make the configuration easier.  But, I did
notice that there are some checks on the metadata version on the connection
that could affect the generation of some certain SQL...

Let us know what you find out.  Thanks.

Kevin


On Thu, Jul 24, 2014 at 8:24 PM, Rick Curtis curti...@gmail.com wrote:

 I haven't seen any MariaDB specific problems reported on this list yet...
 can you explain a bit better what you're observing?

 Thanks,
 Rick


 On Thu, Jul 24, 2014 at 4:05 PM, Marc Logemann marc.logem...@gmail.com
 wrote:

  Hi,
 
  i am fighting weird issues with an openjpa application on MariaDB while
 all
  these are non existant on MySQL. Things like fetch join are just
  different or better said with openjpa 2.2.0 and MariaDB problematic in
 some
  JPQLs.
 
  I even see different SQLs being created from the same JPAQL Queries. Is
  this possible at all?
 
  Thanks for infos.
 



 --
 *Rick Curtis*



Re: Postgres HStore implementation

2014-07-01 Thread Kevin Sutter
Thanks, John.  That write-up would be helpful.

Thanks,
Kevin


On Tue, Jul 1, 2014 at 1:34 AM, Boblitz John john.bobl...@bertschi.com
wrote:

 Thanks Chris!

 The part I was missing was the Annotation - I had almost completed a
 custom implementation, but this works well now.

 FWIW:  With the latest jdbc4 driver from Postgres, a lot of the legwork is
 no longer needed.

 I'll do a write up of my solution and post it to the group - maybe it will
 help someone else.

 Cheers,

 John

  -Original Message-
  From: Krzysztof [mailto:yaz...@gmail.com]
  Sent: Montag, 30. Juni 2014 15:49
  To: users@openjpa.apache.org
  Subject: Re: Postgres HStore implementation
 
  You'd need jdbc mapper for hstore (might be included in newer jdbc
 drivers),
  I use this one:
 
 
 
 /*-
   *
   *  Gaia CU7 variability
   *
   * Copyright (C) 2005-2020 Gaia Data Processing and Analysis
  Consortium
   *
   *
   * CU7 variability software is free software; you can redistribute it
 and/or
   * modify it under the terms of the GNU Lesser General Public
   * License as published by the Free Software Foundation; either
   * version 2.1 of the License, or (at your option) any later version.
   *
   * CU7 variability software is distributed in the hope that it will be
 useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this CU7 variability software; if not, write to the
   * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston,
   * MA  02110-1301  USA
   *
 
 
 *-
   */
  package gaia.cu7.om.dal.dictionary.PGType;
 
  /*
 
   * or more contributor license agreements.  See the NOTICE file
   * distributed with this work for additional information
   * regarding copyright ownership.  The ASF licenses this file
   * to you under the Apache License, Version 2.0 (the
   * License); you may not use this file except in compliance
   * with the License.  You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing,
   * software distributed under the License is distributed on an
   * AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   * KIND, either express or implied.  See the License for the
   * specific language governing permissions and limitations
   * under the License.
   */
 
  import java.io.Serializable;
  import java.util.Collection;
  import java.util.Iterator;
  import java.util.LinkedHashMap;
  import java.util.Map;
  import java.util.Set;
 
  import org.postgresql.util.PGobject;
  import org.postgresql.util.PSQLException;
  import org.postgresql.util.PSQLState;
 
  /**
   * Class that handles hstore contrib datatype.
   * In PG JDBC uses non-standard PGObject interface instead of SQLData
   *
   * @author knienart inspired by Petr Jelinek
   * @version $Id: PGhstore.java 319537 2013-10-08 20:49:15Z knienart $
   * @since 10.0
   */
  @SuppressWarnings(rawtypes)
  public class PGhstore extends PGobject implements Serializable,
 Cloneable,
  Map {
 
private final static long serialVersionUID = 1;
private Map hashList;
 
public PGhstore() {
setType(hstore);
}
 
public PGhstore(String value) throws java.sql.SQLException {
this();
setValue(value);
}
 
@SuppressWarnings(unchecked)
public PGhstore(Map value) {
this();
hashList = new LinkedHashMap(value);
}
 
@SuppressWarnings(unchecked)
@Override
public void setValue(String s) throws java.sql.SQLException {
hashList = new LinkedHashMap();
 
if (s != null) {
char[] chars = s.toCharArray();
String key = null;
StringBuffer buffer = new StringBuffer();
boolean insideKey = true;
boolean insideVal = false;
boolean insideString = false;
 
for (int i = 0; i  chars.length; i++) {
// escape character that we need to skip
if (chars[i] == '\\') {
i++;
}
 
// white space
else if (!insideString 
  Character.isWhitespace(chars[i])) {
continue;
}
 
// the = between key and value
  

Re: openjpa2.2 cannot enhance multiple persistence-unit?

2014-06-26 Thread Kevin Sutter
  The issue described is not clear enough?

Ahhh, no...  Especially when Jose replies with this...

  Yes im using that exactly situtation, and i could enhance multiple
persistence unit.

So, something is not consistent.  You haven't described your persistence
unit definitions (persistence.xml).  You haven't described your enhancement
process -- dynamic or build time.  Are you running within an application
server, or as a standalone Java SE application?  There are many variables
that can affect the entity enhancement processing.

Kevin


On Thu, Jun 26, 2014 at 11:05 AM, gembin gem...@gmail.com wrote:


 The issue described is not clear enough?

 only classes in unit1 are enhanced, none is enhanced in unit2

 Enhanced
 org.example.Entity1

 **NOT Enhanced**
 org.example.Entity2


 Kevin Sutter wrote
  I don't think there ever was consensus that a problem existed...  What
  exact scenario is not working with 2.2.0?
 
 
  On Tue, Jun 24, 2014 at 7:15 PM, robertgass lt;

  robertgass@

  gt; wrote:
 
  Anyone find the solution to this yet?
 
 
 
  --
  View this message in context:
 
 http://openjpa.208410.n2.nabble.com/openjpa2-2-cannot-enhance-multiple-persistence-unit-tp7582993p7586879.html
  Sent from the OpenJPA Users mailing list archive at Nabble.com.
 





 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/openjpa2-2-cannot-enhance-multiple-persistence-unit-tp7582993p7586884.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: openjpa2.2 cannot enhance multiple persistence-unit?

2014-06-25 Thread Kevin Sutter
I don't think there ever was consensus that a problem existed...  What
exact scenario is not working with 2.2.0?


On Tue, Jun 24, 2014 at 7:15 PM, robertgass robertg...@gmail.com wrote:

 Anyone find the solution to this yet?



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/openjpa2-2-cannot-enhance-multiple-persistence-unit-tp7582993p7586879.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: How to prevent multiple inserts of same item (by some criteria)

2014-06-10 Thread Kevin Sutter
I think you are just describing a unique constraint for a column (other
than the primary key).  Here's one reference in the OpenJPA documentation,
but there are several references through out the documentation or other
JPA-related documentation.

http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#jpa_overview_mapping_unq

Kevin


On Tue, Jun 10, 2014 at 9:44 AM, Rupert Smith rupertlssm...@googlemail.com
wrote:

 Hi,

 Is there a way to prevent JPA/OpenJPA from doing multiple inserts?

 I have a somewhat inconvenient database design, whereby some types held in
 a table only allow a single instance to be created (other types do allow
 it). This makes preventing multiple instances not so easy to achieve with
 simple unique constraints.

 What I effectively want to do is something like this:

 INSERT INTO Applications (..., type)
 VALUES (..., someType)
 WHERE NOT EXISTS (SELECT FROM Applications WHERE type = someType)

 That is for some Applications where only a single instance is allowed for a
 type, to prevent multiple instances from being inserted.

 Only answer I have found so far is:


 http://www.quora.com/Relational-Databases/JPA-conditional-insertion-RDBMS-transactions-isolation

 But I cannot make sense of it.

 Thanks for your help.

 Rupert



Re: How to prevent multiple inserts of same item (by some criteria)

2014-06-10 Thread Kevin Sutter
Okay, Rupert.  I guess I read your initial note too quickly...  :-)  Sorry
about that.

I don't see how you could automate this type of checking into a single JPA
interaction with the database.  You could accomplish something like this
with multiple SQL statements, but then the logic and locking is pretty much
left up to you.

(BTW, I didn't care for Quora's sign-in requirements, so I didn't actually
read the reference you posted.)

Good luck,
Kevin


On Tue, Jun 10, 2014 at 12:43 PM, Rupert Smith rupertlssm...@googlemail.com
 wrote:

 On 10 June 2014 16:31, Kevin Sutter kwsut...@gmail.com wrote:

  I think you are just describing a unique constraint for a column (other
  than the primary key).


 Sadly not, it isn't simply a question of putting a unique constraint on
 some columns. As I pointed out, in some cases a duplicate is allowed, in
 others it is not. I could just re-arrange the database design, but I don't
 own the design it is something that has been given to me.

 Consider the case where the criteria to allow an insert to happen is some
 arbitrary query, not just a unique constraint. This can be accomplished
 with a WHERE NOT EXISTS (SELECT ... the arbitrary insertion condition). How
 can this be done with JPA/OpenJPA?

 Rupert



Re: behavior change from 2.1.0 to 2.2.0 on persist

2014-06-03 Thread Kevin Sutter
Hi Marc,
I do like Boblitz's suggestion of using getReference.  It's a little less
weight than a full find() operation.

Kevin


On Tue, Jun 3, 2014 at 9:07 AM, Marc Logemann marc.logem...@gmail.com
wrote:

 Rick,

 thanks for pointing out. I will check this too. But regardless of the
 outcome, i think we will recode the stuff which is affected, because its
 better coding style to load related entities and point the managed entities
 to the desired other entities. This way people know whats going on without
 relying on any ORM magic.


 2014-06-02 18:26 GMT+02:00 Rick Curtis curti...@gmail.com:

  Marc --
 
  I'm thinking that there was a change in cascade persist behavior that you
  might be running into.
 
 
 
 http://openjpa.apache.org/builds/2.2.2/apache-openjpa/docs/jpa_2.2.html#jpa_2.2_cascadePersist
 
 
  On Mon, Jun 2, 2014 at 9:53 AM, Marc Logemann marc.logem...@gmail.com
  wrote:
 
   Kevin,
  
   thanks for fast feedback. To your questions:
  
   1) of course we could do the em.find() and do it the way it should be
  done
   ;-)
  
   2) no, we have not tried using em.merge(), this would be an option we
  could
   check out.
  
   And yes. WE dont want to persist the CustomerType since its already
  there.
   We just want to create the relationship.
  
   Thanks again. And now we will happily wait for Java8 Support in your
   bytecode enhancer  so that we could upgrade to latest Version of
 OpenJPA
   instead of being stuck to 2.2.0 ;-)
  
   Marc
  
  
   2014-06-02 16:11 GMT+02:00 Kevin Sutter kwsut...@gmail.com:
  
Hi Marc,
Sorry for the troubles.  Technically, it looks like you were lucky
 and
coding to a bug in the OpenJPA code.  Since you just created this
CustomerType, we have to assume that it's unmanaged.  And, we can't
automatically cascade the persist operation to this unmanaged entity.
And,
in your particular case, we wouldn't want to persist this entity
 since
  it
already exists.
   
Just to be clear, you don't want this CustomerType to be persisted,
   right?
You are just creating this to satisfy the relationship from Person,
   right?
   
A couple of ideas come to mind...
   
1)  Can you do an em.find() operation on your CustomerType?  I
 realize
   this
is an extra SQL, but then this CustomerType would be managed and
  satisfy
the requirement.
   
2)  Have you tried using em.merge(p) instead of em.persist(p)?  The
  merge
should do either the update or insert based on the state of the
 object.
When we get to the CustomerType, we might have to do the extra SQL to
determine if it exists already, but then we should be okay.  This
 JIRA
   [1]
from the 2.2.0 Release Notes [2] makes me think this might work...
   
Maybe somebody else has some ideas on how to get around this
 scenario.
   
[1]  https://issues.apache.org/jira/browse/OPENJPA-1896
[2]
   
  http://openjpa.apache.org/builds/2.2.0/apache-openjpa/RELEASE-NOTES.html
   
   
   
   
On Mon, Jun 2, 2014 at 7:48 AM, Marc Logemann 
 marc.logem...@gmail.com
  
wrote:
   
 Hey,

 we recently switched to 2.2.0 (cant go higher because we use Java8)
  and
we
 found a change in behavior.

 Asumme we created a new Entity which looks like this:

 Person.java
 --
 int oid
 String name
 CustomerType adress


 we created the object like so:

 Person p = new Person();
 p.setName(foo);

 CustomerType ct = new CustomerType();
 ct.setOid(1); // THIS OID already exists and we want to map the
   existant
 object to Person

 p.setCustomerType(ct);

 persist(p);


 =

 In 2.1.0 OpemJPA knew that there is a CustomerType in the DB with
  this
oid
 and loads it automaticly and the child object is managed. With
  2.2.0
this
 is no longer the case and we get a Unmanaged bla bla bla
 Exception.
   We
 relied on that behavior heavily and the rewrite is a tough for all
   areas.
 Is there some kind of config setting where i can set the old
   behavior.
Or
 was this old behavior a bug? ;-)

 Thanks for hints.

 Marc

   
  
 
 
 
  --
  *Rick Curtis*
 



Re: behavior change from 2.1.0 to 2.2.0 on persist

2014-06-02 Thread Kevin Sutter
Hi Marc,
Sorry for the troubles.  Technically, it looks like you were lucky and
coding to a bug in the OpenJPA code.  Since you just created this
CustomerType, we have to assume that it's unmanaged.  And, we can't
automatically cascade the persist operation to this unmanaged entity.  And,
in your particular case, we wouldn't want to persist this entity since it
already exists.

Just to be clear, you don't want this CustomerType to be persisted, right?
You are just creating this to satisfy the relationship from Person, right?

A couple of ideas come to mind...

1)  Can you do an em.find() operation on your CustomerType?  I realize this
is an extra SQL, but then this CustomerType would be managed and satisfy
the requirement.

2)  Have you tried using em.merge(p) instead of em.persist(p)?  The merge
should do either the update or insert based on the state of the object.
When we get to the CustomerType, we might have to do the extra SQL to
determine if it exists already, but then we should be okay.  This JIRA [1]
from the 2.2.0 Release Notes [2] makes me think this might work...

Maybe somebody else has some ideas on how to get around this scenario.

[1]  https://issues.apache.org/jira/browse/OPENJPA-1896
[2]
http://openjpa.apache.org/builds/2.2.0/apache-openjpa/RELEASE-NOTES.html




On Mon, Jun 2, 2014 at 7:48 AM, Marc Logemann marc.logem...@gmail.com
wrote:

 Hey,

 we recently switched to 2.2.0 (cant go higher because we use Java8) and we
 found a change in behavior.

 Asumme we created a new Entity which looks like this:

 Person.java
 --
 int oid
 String name
 CustomerType adress


 we created the object like so:

 Person p = new Person();
 p.setName(foo);

 CustomerType ct = new CustomerType();
 ct.setOid(1); // THIS OID already exists and we want to map the existant
 object to Person

 p.setCustomerType(ct);

 persist(p);


 =

 In 2.1.0 OpemJPA knew that there is a CustomerType in the DB with this oid
 and loads it automaticly and the child object is managed. With 2.2.0 this
 is no longer the case and we get a Unmanaged bla bla bla Exception. We
 relied on that behavior heavily and the rewrite is a tough for all areas.
 Is there some kind of config setting where i can set the old behavior. Or
 was this old behavior a bug? ;-)

 Thanks for hints.

 Marc



Re: Java enum column incompatibility warning

2014-05-23 Thread Kevin Sutter
Hi Jason,
Something's out of whack...  I went to the code that determines the size to
use for enum fields and it has used the largest enum string length since
2006...  We have never defaulted to 255 for @Enumerated types, for any
database...

The DDL you posted was for 2.3.0.  Any chance you still have your 2.2.x
environment and you can capture the ddl for that run?

The code is quite simple if you are interested.  Here links for the 2.2.x
branch as well as 2.3.0.  The code that is doing this length determination
is like this:

if (_ordinal)
col.setJavaType(JavaTypes.SHORT);
else {
// look for the longest enum value name; use 20 as min length to
// leave room for future long names
int len = 20;
for (int i = 0; i  _vals.length; i++)
len = Math.max(_vals[i].name().length(), len);

col.setJavaType(JavaTypes.STRING);
col.setSize(len);
}

[1]
https://svn.apache.org/repos/asf/openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/EnumValueHandler.java
[2]
https://svn.apache.org/repos/asf/openjpa/tags/2.3.0/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/EnumValueHandler.java


On Fri, May 23, 2014 at 8:17 AM, Jason Reilly jdr0...@renci.org wrote:

 Sure


 Here is the log statement:

 2014-05-22 14:26:44,437 | WARN  | Thread-128   | Schema
 | b.log.SLF4JLogFactory$LogAdapter  103 | 156 -
 org.apache.openjpa - 2.3.0 | Existing column mime_type on table
 public.file_data is incompatible with the same column in the given schema
 definition. Existing column:

 Full Name: file_data.mime_type

 Type: varchar

 Size: 255

 Default: null

 Not Null: false

 Given column:

 Full Name: file_data.mime_type

 Type: varchar

 Size: 30

 Default: null

 Not Null: false



 And here is the column declaration in my model for FileData.mimeType:

 @Column(name = mime_type)

 @Enumerated(EnumType.STRING)

 private MimeType mimeType;



 And from the schema creation script:

 CREATE TABLE file_data (file_data_id BIGINT NOT NULL, date_created
 TIMESTAMP, md5 VARCHAR(255), mime_type VARCHAR(30), name VARCHAR(255), path
 VARCHAR(32672), PRIMARY KEY (file_data_id));


 The longest value in the MimeType enum is 30 characters in length.
 Observing some of the other warning messages, it seems that if the Enum
 value length is less than 20, the expected column length is 20.  So, 20 is
 the lower bounds.

 Regards,
 Jason


 On 05/22/2014 05:01 PM, Kevin Sutter wrote:

 Hi Jason,
 I'm not aware of a change that went into 2.3.0 that would affect this type
 of processing.  I just searched the JIRAs as well and didn't find
 anything...  Can you post the exact warning message you are receiving?
 Along with your Entity definition of the Enumerated type?  And, extract
 the
 schema definition from your database?  I know we've had some issues with
 sequence generators and Postgres, but I'm not aware of any issues with the
 processing of enums.

 Thanks, Kevin


 On Thu, May 22, 2014 at 3:30 PM, Jason Reilly jdr0...@renci.org wrote:

  With OpenJPA 2.2.2, the generated column length for an
 @Enumerated(EnumType.STRING) is varchar(255) in Postgresql.  With an
 upgrade to OpenJPA 2.3.0, I think that the expected column length is the
 length of the Enum's longest valueusually shorter than 255
 characters.
   I suspect this could problematic (at least annoying) if the database
 schema was first created with OpenJPA 2.3.0 and the database column
 length
 had to be adjusted every time I add a new Enum that is longer than the
 previously longest Enum value.


 On 05/22/2014 04:09 PM, Kevin Sutter wrote:

  Well, if you don't have access or the means to update this varchar
 length,
 then you probably have to ignore it...  :-)  This is a warning to
 indicate
 a mismatch.  I suppose you can ignore it, but then you have a chance of
 truncated values.  Are the enum values pre-defined like the column size?
 Or, can you maybe abbreviate the enum values to make them fit the column
 size?  It's really up to you whether these warnings are safe to ignore
 or
 not.

 Kevin


 On Thu, May 22, 2014 at 2:10 PM, Jason Reilly jdr0...@renci.org
 wrote:

   SorryI am using OpenJPA 2.3.0


 On 05/22/2014 03:09 PM, Jason Reilly wrote:

   Hi all,

 I am getting a warning that the column that an Enum is mapped to (as a
 string) is incompatible with the column in the schema definition.
 Looks
 like the expected column size is the length of the longest Enum value.
   As
 it is a warning and I don't easily have access to change the varchar
 length, can this be safely ignored?

 Thanks,
 Jason








Re: [ANNOUNCE] OpenJPA 2.3.0 Released (Finally!)

2014-05-23 Thread Kevin Sutter
That is part of the Release Notes, which is available for every release on
our download page [1].  Here's a direct link to the 2.3.0 Release Notes:
http://openjpa.apache.org/builds/2.3.0/apache-openjpa/RELEASE-NOTES.html

[1]  http://openjpa.apache.org/downloads.html


On Fri, May 23, 2014 at 11:06 AM, Datin Benoit 
benoit.da...@thomson-networks.com wrote:

 Hi Kevin,

 Where can we found the issues list that are resolved in this new version
 please ?

 Regards
 Benoit DATIN

 -Original Message-
 From: kwsut...@gmail.com [mailto:kwsut...@gmail.com] On Behalf Of Kevin
 Sutter
 Sent: jeudi 15 mai 2014 19:21
 To: annou...@apache.org; users@openjpa.apache.org; d...@openjpa.apache.org
 Subject: [ANNOUNCE] OpenJPA 2.3.0 Released (Finally!)

 The Apache OpenJPA community is proud to announce the OpenJPA
 2.3.0 release!

 (Although the actual release was completed last fall, the final posting of
 the distribution artifacts, documentation, and announcement material was
 just performed.  Thus, this belated announcement...  Thank you for your
 patience.)

 Please visit our project website to learn more about Apache OpenJPA and
 how to download or include our persistence provider in your builds.

 http://openjpa.apache.org/

 Apache OpenJPA PMC



Re: Java enum column incompatibility warning

2014-05-23 Thread Kevin Sutter
Interesting.  Can you provide your MimeType.java?  Thanks!


On Fri, May 23, 2014 at 11:51 AM, Jason Reilly jdr0...@renci.org wrote:

 Changing *just* the openjpa dependency version to 2.2.2 in my pom, the
 schema creation looks like this:

 CREATE TABLE file_data (file_data_id BIGINT NOT NULL, date_created
 TIMESTAMP, md5 VARCHAR(255), mime_type VARCHAR(255), name VARCHAR(255),
 path VARCHAR(32672), PRIMARY KEY (file_data_id));


 Regards,
 Jason


 On 05/23/2014 10:49 AM, Kevin Sutter wrote:

 Hi Jason,
 Something's out of whack...  I went to the code that determines the size
 to
 use for enum fields and it has used the largest enum string length since
 2006...  We have never defaulted to 255 for @Enumerated types, for any
 database...

 The DDL you posted was for 2.3.0.  Any chance you still have your 2.2.x
 environment and you can capture the ddl for that run?

 The code is quite simple if you are interested.  Here links for the 2.2.x
 branch as well as 2.3.0.  The code that is doing this length determination
 is like this:

  if (_ordinal)
  col.setJavaType(JavaTypes.SHORT);
  else {
  // look for the longest enum value name; use 20 as min
 length to
  // leave room for future long names
  int len = 20;
  for (int i = 0; i  _vals.length; i++)
  len = Math.max(_vals[i].name().length(), len);

  col.setJavaType(JavaTypes.STRING);
  col.setSize(len);
  }

 [1]
 https://svn.apache.org/repos/asf/openjpa/branches/2.2.x/
 openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/
 strats/EnumValueHandler.java
 [2]
 https://svn.apache.org/repos/asf/openjpa/tags/2.3.0/
 openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/
 strats/EnumValueHandler.java


 On Fri, May 23, 2014 at 8:17 AM, Jason Reilly jdr0...@renci.org wrote:

  Sure


 Here is the log statement:

 2014-05-22 14:26:44,437 | WARN  | Thread-128   | Schema
  | b.log.SLF4JLogFactory$LogAdapter  103 | 156 -
 org.apache.openjpa - 2.3.0 | Existing column mime_type on table
 public.file_data is incompatible with the same column in the given
 schema
 definition. Existing column:

 Full Name: file_data.mime_type

 Type: varchar

 Size: 255

 Default: null

 Not Null: false

 Given column:

 Full Name: file_data.mime_type

 Type: varchar

 Size: 30

 Default: null

 Not Null: false



 And here is the column declaration in my model for FileData.mimeType:

  @Column(name = mime_type)

  @Enumerated(EnumType.STRING)

  private MimeType mimeType;



 And from the schema creation script:

 CREATE TABLE file_data (file_data_id BIGINT NOT NULL, date_created
 TIMESTAMP, md5 VARCHAR(255), mime_type VARCHAR(30), name VARCHAR(255),
 path
 VARCHAR(32672), PRIMARY KEY (file_data_id));


 The longest value in the MimeType enum is 30 characters in length.
 Observing some of the other warning messages, it seems that if the Enum
 value length is less than 20, the expected column length is 20.  So, 20
 is
 the lower bounds.

 Regards,
 Jason


 On 05/22/2014 05:01 PM, Kevin Sutter wrote:

  Hi Jason,
 I'm not aware of a change that went into 2.3.0 that would affect this
 type
 of processing.  I just searched the JIRAs as well and didn't find
 anything...  Can you post the exact warning message you are receiving?
 Along with your Entity definition of the Enumerated type?  And, extract
 the
 schema definition from your database?  I know we've had some issues with
 sequence generators and Postgres, but I'm not aware of any issues with
 the
 processing of enums.

 Thanks, Kevin


 On Thu, May 22, 2014 at 3:30 PM, Jason Reilly jdr0...@renci.org
 wrote:

   With OpenJPA 2.2.2, the generated column length for an

 @Enumerated(EnumType.STRING) is varchar(255) in Postgresql.  With an
 upgrade to OpenJPA 2.3.0, I think that the expected column length is
 the
 length of the Enum's longest valueusually shorter than 255
 characters.
I suspect this could problematic (at least annoying) if the database
 schema was first created with OpenJPA 2.3.0 and the database column
 length
 had to be adjusted every time I add a new Enum that is longer than the
 previously longest Enum value.


 On 05/22/2014 04:09 PM, Kevin Sutter wrote:

   Well, if you don't have access or the means to update this varchar

 length,
 then you probably have to ignore it...  :-)  This is a warning to
 indicate
 a mismatch.  I suppose you can ignore it, but then you have a chance
 of
 truncated values.  Are the enum values pre-defined like the column
 size?
 Or, can you maybe abbreviate the enum values to make them fit the
 column
 size?  It's really up to you whether these warnings are safe to ignore
 or
 not.

 Kevin


 On Thu, May 22, 2014 at 2:10 PM, Jason Reilly jdr0...@renci.org
 wrote:

SorryI am using OpenJPA 2.3.0

  On 05/22/2014 03:09 PM, Jason Reilly wrote:

Hi all,

  I am getting a warning that the column that an Enum is mapped

Re: Why is EntityManager refresh(...) not working for me?

2014-05-22 Thread Kevin Sutter
If you are calling EM.refresh() directly, you should get a refreshed
version of the entity that is committed to the database.  Any relationships
to other entities will only be refreshed if you are using the
CascadeType.REFRESH (or ALL) specified on your relationship [1].  The other
thing that can affect refreshing is the use of the L2 data cache.  Any
chance you have that enabled?  A copy of your persistence.xml is always
helpful with understanding your environment.  Thanks.

[1]
http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#jpa_overview_meta_cascade


On Thu, May 22, 2014 at 10:22 AM, sim085 sim...@hotmail.com wrote:

 Hello,

 I am working on a web project where the underlying database can get updated
 by an other systems. My scenario is as follows: I have the following
 tables;
 USERS and HOBBY. I mapped a User object with the USERS table and a Hobby
 object with the HOBBY table. A User can have one ore more Hobby so I have a
 ListHobby in User mapped using the annotation @OneToMany. A Hobby can be
 linked with only one User so I use the annotation @ManyToOne from Hobby.

 My problem, as indicated int he first sentence, is that the HOBBY table may
 be updated through another system (outside of JPA world). When this
 happens,
 when I call User user = em.find(1) the object I get does not reflect the
 real data there is in the the database but the same data I had for this
 User
 as it was when I last interacted with the EntityManager for this particular
 user.

 In other words, if User 1 had four Hobby and the other system add another
 two Hobby to User 1 then when I go to the screen that shows me all Hobby
 for
 User 1 I get four because last time I got User 1 using JPA this User had
 four Hobby!

 I went to the Java API for the EntityManager and I found two methods:

 *refresh(java.lang.Object entity) *
 /Refresh the state of the instance from the database, overwriting changes
 made to the entity, if any./

 *flush() *
 /Synchronize the persistence context to the underlying database./

 I tried them both but none are working for me. Does anyone know what I am
 doing wrong?




 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/Why-is-EntityManager-refresh-not-working-for-me-tp7586653.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Java enum column incompatibility warning

2014-05-22 Thread Kevin Sutter
Well, if you don't have access or the means to update this varchar length,
then you probably have to ignore it...  :-)  This is a warning to indicate
a mismatch.  I suppose you can ignore it, but then you have a chance of
truncated values.  Are the enum values pre-defined like the column size?
Or, can you maybe abbreviate the enum values to make them fit the column
size?  It's really up to you whether these warnings are safe to ignore or
not.

Kevin


On Thu, May 22, 2014 at 2:10 PM, Jason Reilly jdr0...@renci.org wrote:

 SorryI am using OpenJPA 2.3.0


 On 05/22/2014 03:09 PM, Jason Reilly wrote:

 Hi all,

 I am getting a warning that the column that an Enum is mapped to (as a
 string) is incompatible with the column in the schema definition. Looks
 like the expected column size is the length of the longest Enum value.  As
 it is a warning and I don't easily have access to change the varchar
 length, can this be safely ignored?

 Thanks,
 Jason






Re: Java enum column incompatibility warning

2014-05-22 Thread Kevin Sutter
Hi Jason,
I'm not aware of a change that went into 2.3.0 that would affect this type
of processing.  I just searched the JIRAs as well and didn't find
anything...  Can you post the exact warning message you are receiving?
Along with your Entity definition of the Enumerated type?  And, extract the
schema definition from your database?  I know we've had some issues with
sequence generators and Postgres, but I'm not aware of any issues with the
processing of enums.

Thanks, Kevin


On Thu, May 22, 2014 at 3:30 PM, Jason Reilly jdr0...@renci.org wrote:

 With OpenJPA 2.2.2, the generated column length for an
 @Enumerated(EnumType.STRING) is varchar(255) in Postgresql.  With an
 upgrade to OpenJPA 2.3.0, I think that the expected column length is the
 length of the Enum's longest valueusually shorter than 255 characters.
  I suspect this could problematic (at least annoying) if the database
 schema was first created with OpenJPA 2.3.0 and the database column length
 had to be adjusted every time I add a new Enum that is longer than the
 previously longest Enum value.


 On 05/22/2014 04:09 PM, Kevin Sutter wrote:

 Well, if you don't have access or the means to update this varchar length,
 then you probably have to ignore it...  :-)  This is a warning to indicate
 a mismatch.  I suppose you can ignore it, but then you have a chance of
 truncated values.  Are the enum values pre-defined like the column size?
 Or, can you maybe abbreviate the enum values to make them fit the column
 size?  It's really up to you whether these warnings are safe to ignore or
 not.

 Kevin


 On Thu, May 22, 2014 at 2:10 PM, Jason Reilly jdr0...@renci.org wrote:

  SorryI am using OpenJPA 2.3.0


 On 05/22/2014 03:09 PM, Jason Reilly wrote:

  Hi all,

 I am getting a warning that the column that an Enum is mapped to (as a
 string) is incompatible with the column in the schema definition. Looks
 like the expected column size is the length of the longest Enum value.
  As
 it is a warning and I don't easily have access to change the varchar
 length, can this be safely ignored?

 Thanks,
 Jason







Re: Information for XA Transaction

2014-05-21 Thread Kevin Sutter
You would probably do better by posting this type of question to the
users forum.  The dev forum is for development of the OpenJPA project.
Of course, we would welcome any contributions and participation, but I
think you are looking for usage expertise, not development.

Since OpenJPA is WebSphere's JPA solution, there isn't much configuration
required from an OpenJPA perspective.  The configuration should be mainly
on the WebSphere side.  You will need to configure your datasource to use
the XA JDBC driver.  And, you'll need to demarcate user/global transactions
either via Bean-managed or Container-managed mechanisms.  Once you have
those items configured and in use, then the coordination of the resources
is up to the Transaction manager in WebSphere.

Of course, you didn't mention how heavily integrated your Spring usage is.
Depending on how much of the Spring features you are trying to use, you may
need to configure Spring to understand that WebSphere is in play.  A good
starting point for that is this article by Tom Alcott and friends:
http://www.ibm.com/developerworks/websphere/techjournal/0609_alcott/0609_alcott.html

It mentions Hibernate as well, but using the WebSphere JPA provider should
make that easier.

Referencing Spring's documentation is also good.  They have many examples
of integrating with WebSphere.

Good luck,
Kevin


On Mon, May 19, 2014 at 10:46 AM, Jangle, Sachin 
jangle.sac...@principal.com wrote:

 Hi

 For a Java application we need to implement Distributed Transaction (XA
 transaction).
 Can you please help in regards to the OPENJPA related configurations to be
 made.

 Following is high level technical requirement of application.
 1)  Application will pull data from MQ.
 2)  Perform update transaction on 2 database.
 3)  Send notification through Topics/MQ.
 All of the above steps need to be managed as one LUW.


 Following technologies are being used
 1)  Open JPA
 2)  Spring
 3)  Web sphere
 4)  SMTP.
 5)  IBM MQ


 Thanks,
 Sachin Jangle

 -Message Disclaimer-

 This e-mail message is intended only for the use of the individual or
 entity to which it is addressed, and may contain information that is
 privileged, confidential and exempt from disclosure under applicable law.
 If you are not the intended recipient, any dissemination, distribution or
 copying of this communication is strictly prohibited. If you have
 received this communication in error, please notify us immediately by
 reply email to conn...@principal.com and delete or destroy all copies of
 the original message and attachments thereto. Email sent to or from the
 Principal Financial Group or any of its member companies may be retained
 as required by law or regulation.

 Nothing in this message is intended to constitute an Electronic signature
 for purposes of the Uniform Electronic Transactions Act (UETA) or the
 Electronic Signatures in Global and National Commerce Act (E-Sign)
 unless a specific statement to the contrary is included in this message.

 While this communication may be used to promote or market a transaction
 or an idea that is discussed in the publication, it is intended to provide
 general information about the subject matter covered and is provided with
 the understanding that The Principal is not rendering legal, accounting,
 or tax advice. It is not a marketed opinion and may not be used to avoid
 penalties under the Internal Revenue Code. You should consult with
 appropriate counsel or other advisors on all matters pertaining to legal,
 tax, or accounting obligations and requirements



Re: OpenJPA 2.3

2014-05-20 Thread Kevin Sutter
Try refreshing your page...  You may have an old version in your browser
cache.  I've verified that it does exist.  I'm not sure how this mailing
list works with screen shots, but here's what I see on the Download page (
http://openjpa.apache.org/downloads.html):



Thanks.  Let me know if that resolves this for you or if you continue to
see something different...

Kevin


On Tue, May 20, 2014 at 6:22 AM, Boblitz John john.bobl...@bertschi.comwrote:

 Hello Kevin,

 the Documentation link works fine.  The Download link does not contain
 links to the 2.3.0 download.  I can modify the address from the 2.2.2
 release in the browser and that takes me to the correct page ...

 Regards,

 John

  -Original Message-
  From: Kevin Sutter [mailto:kwsut...@gmail.com]
  Sent: Thursday, May 15, 2014 7:23 PM
  To: users@openjpa.apache.org
  Subject: Re: OpenJPA 2.3
 
  OpenJPA 2.3.0 should now be available:
 
  http://openjpa.apache.org/downloads.html
  http://openjpa.apache.org/documentation.html
 
  Kevin
 
 
  On Wed, May 14, 2014 at 8:58 AM, Boblitz John
  john.bobl...@bertschi.comwrote:
 
   Thanks and keep up the good work!
  
   Cheers,
  
   John
  
-Original Message-
From: Kevin Sutter [mailto:kwsut...@gmail.com]
Sent: Wednesday, May 14, 2014 2:59 PM
To: users@openjpa.apache.org
Subject: Re: OpenJPA 2.3
   
Hi John,
Yes, there is a 2.3.0 release of OpenJPA... We're working through
the issues of making this more public.  We dropped the ball at the
end of the release and we still have some cleanup...  We hope to get
this all straightened out by the end of the week.
   
Kevin
   
   
   
   
On Tue, May 13, 2014 at 2:53 AM, Boblitz John
john.bobl...@bertschi.comwrote:
   
 Hello,

 I have heard that openJPA 2.3 is available, but there are no links
 / news on the Web Page regarding this.  Is 2.3 released?


 John
 
 Who is General Failure, and why is he reading my hard disk?




  



Re: Broken Link

2014-05-20 Thread Kevin Sutter
Hi John,
That was supposed to be meant as purely an example...  It was never linked
up to a real url.  I'll update the page to be clearer on this.

Kevin


On Tue, May 20, 2014 at 8:21 AM, Boblitz John john.bobl...@bertschi.comwrote:

 Hello,

 I was looking about for an example of the JSON format in JEST and thought
 I found a link on the page:

 http://openjpa.apache.org/jest-syntax.html


 The Page contains, in part:

 For example, to find a persistent Person instance with primary key 1234
 and receive the result in JSON format will be:
 http://www.example.com:8080/jest/find/format=json?type=Person1234
 following that link however does not seem to lead anywhere ...

 is the link still valid / the page still reachable?

 Freundliche Grüsse / best regards
 John Boblitz
 EDV-Abteilung
 Bertschi AG
 __
 Hutmattstr. 22, CH-5724 Dürrenäsch
 Tel:  +41 (0)62 767 67 04
 john.bobl...@bertschi.commailto:john.bobl...@bertschi.com
 www.bertschi.comhttp://www.bertschi.com/



Re: Broken Link

2014-05-20 Thread Kevin Sutter
I would suggest trying this example:
https://openjpa.apache.org/jest-examples.html

No guarantees though...  JEST is not a heavily used feature, so there may
be some hiccups with the sample.  Good luck!

Kevin


On Tue, May 20, 2014 at 8:36 AM, Boblitz John john.bobl...@bertschi.comwrote:

 Thanks to both of you ...

 any chance of seeing what that json output might look like?

  -Original Message-
  From: Rick Curtis [mailto:curti...@gmail.com]
  Sent: Tuesday, May 20, 2014 3:28 PM
  To: users
  Subject: Re: Broken Link
 
   is the link still valid / the page still reachable?
  I don't believe that was ever a valid link, I'm quite certain that it is
  just used for illustrative purposes.
 
  Thanks,
  Rick
 
 
  On Tue, May 20, 2014 at 8:21 AM, Boblitz John
  john.bobl...@bertschi.comwrote:
 
   Hello,
  
   I was looking about for an example of the JSON format in JEST and
   thought I found a link on the page:
  
   http://openjpa.apache.org/jest-syntax.html
  
  
   The Page contains, in part:
  
   For example, to find a persistent Person instance with primary key
   1234 and receive the result in JSON format will be:
   http://www.example.com:8080/jest/find/format=json?type=Person1234
   following that link however does not seem to lead anywhere ...
  
   is the link still valid / the page still reachable?
  
   Freundliche Grüsse / best regards
   John Boblitz
   EDV-Abteilung
   Bertschi AG
   __
   Hutmattstr. 22, CH-5724 Dürrenäsch
   Tel:  +41 (0)62 767 67 04
   john.bobl...@bertschi.commailto:john.bobl...@bertschi.com
   www.bertschi.comhttp://www.bertschi.com/
  
 
 
 
  --
  *Rick Curtis*



[ANNOUNCE] OpenJPA 2.3.0 Released (Finally!)

2014-05-16 Thread Kevin Sutter
The Apache OpenJPA community is proud to announce the OpenJPA
2.3.0 release!

(Although the actual release was completed last fall, the final posting of
the distribution artifacts, documentation, and announcement material was
just performed.  Thus, this belated announcement...  Thank you for your
patience.)

Please visit our project website to learn more about Apache OpenJPA and
how to download or include our persistence provider in your builds.

http://openjpa.apache.org/

Apache OpenJPA PMC


Re: JPQL and DB2 native code

2014-05-16 Thread Kevin Sutter
Hi Christophe,
So, you are attempting to use the Temporal support for DB2?  That's pretty
cool.  We had entertained that support a some time ago, but updating the
JPQL is a killer.  Once we update the JPQL then we've broken the standard
as defined by the specification.  So, integrating the Temporal support
directly into the Java object model and the associated JPQL was
deep-sixed...  At least until this becomes back of the JDBC/SQL standard.

So, in the mean time, I would suggest using native SQL instead of
attempting to use JPQL.  When using native SQL, OpenJPA just puts on the
blinders and passes the SQL through to the backend database.  The OpenJPA
manual [1] touches on this native SQL support.  But, you may also want to
reference the specification [2] and/or the Pro JPA 2 book [3] for more
information.

Good luck,
Kevin

[1]
http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#jpa_overview_sqlquery
[2]  https://jcp.org/aboutJava/communityprocess/final/jsr317/
[3]  http://www.amazon.com/Pro-JPA-2-Mike-Keith/dp/1430249269


On Wed, May 14, 2014 at 2:50 AM, Christophe Marcourt christo...@marcourt.ch
 wrote:

 Hello,

 I'm using a DB2 native functionality for the historic.
 As the query are proprietary : select * from table_name *for system_time
 between* from_date *and *to_date where where_clause... I had to use
 pure SQL.

 I'm having a problem as JPQL parser can't parse this query. The for
 system_time between ... and ... is not known by JQPL.

 Is there a way to override, intercept or listen this parsing ?

 What is the object to use DBDictionary, JPQLParser, else ?

 Thank you for your help.

 Christophe Marcourt



Re: OpenJPA 2.3

2014-05-16 Thread Kevin Sutter
OpenJPA 2.3.0 should now be available:

http://openjpa.apache.org/downloads.html
http://openjpa.apache.org/documentation.html

Kevin


On Wed, May 14, 2014 at 8:58 AM, Boblitz John john.bobl...@bertschi.comwrote:

 Thanks and keep up the good work!

 Cheers,

 John

  -Original Message-
  From: Kevin Sutter [mailto:kwsut...@gmail.com]
  Sent: Wednesday, May 14, 2014 2:59 PM
  To: users@openjpa.apache.org
  Subject: Re: OpenJPA 2.3
 
  Hi John,
  Yes, there is a 2.3.0 release of OpenJPA... We're working through the
  issues of making this more public.  We dropped the ball at the end of
  the release and we still have some cleanup...  We hope to get this all
  straightened out by the end of the week.
 
  Kevin
 
 
 
 
  On Tue, May 13, 2014 at 2:53 AM, Boblitz John
  john.bobl...@bertschi.comwrote:
 
   Hello,
  
   I have heard that openJPA 2.3 is available, but there are no links /
   news on the Web Page regarding this.  Is 2.3 released?
  
  
   John
   
   Who is General Failure, and why is he reading my hard disk?
  
  
  
  



Re: Trouble with persistent element (extended schema) when field name does not match column name

2014-05-16 Thread Kevin Sutter
Really?  That was it?  Normally, that xml element just says not to look at
annotations, everything is in the xml...  If you can document this as a
JIRA [1], it would be appreciated.  Thanks.

Kevin

[1]  https://openjpa.apache.org/found-a-bug.html


On Wed, May 7, 2014 at 8:17 AM, kate.tier...@ge.com wrote:

 I figured out my problem. I was missing  metadata-complete=true on my
 entity element. Once I added that, the error went away.

 Thanks!

 quote author='Kevin Sutter'
 Have you tried turning on trace?  The simple column name mapping is part of
 the spec, so that should work regardless.  Applying the externalizer is an
 OpenJPA extension to the orm.xml, but it doesn't even seem like you are
 getting that far.  Maybe the trace will help show where the processing is
 going awry...  Good luck!

 Kevin


 On Wed, Apr 30, 2014 at 7:09 AM, Tierney, Mary K (GE Healthcare) 
 kate.tier...@ge.com wrote:

  I have the following:
 
  public abstract class Person {
  ...
  protected Boolean isActive;
  ...
  }
 
  Person table with column IsInactiveFLAG - char(1)
 
  I am trying to use the Externalizer/Factory combo to transform the value
  into a Boolean for use in code.
 
  In my orm.xml file (using the extended schema), I have the following:
 
  basic name=isActive
 
  orm:column name=IsInactiveFLAG column-definition=char(1)/
  /basic
  openjpa:attributes
 
  openjpa:persistent name=isActive
 
externalizer=InvertedYesNoMapper.toDbValue
 
factory=InvertedYesNoMapper.toValue/
  /openjpa:attributes
 
  I get the following error at runtime:
 
  ...Person.isActive declares column isActive, but this column does not
  exist in table dbo.PERSON
  at
 
 org.apache.openjpa.jdbc.meta.MappingInfo.mergeColumn(MappingInfo.java:692)
  at
 
 org.apache.openjpa.jdbc.meta.MappingInfo.createColumns(MappingInfo.java:593)
  at
 
 org.apache.openjpa.jdbc.meta.ValueMappingInfo.getColumns(ValueMappingInfo.java:178)
  at
 
 org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy.map(StringFieldStrategy.java:84)
  at
 
 org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:146)
  at
 
 org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:82)
  at
 
 org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:496)
  at
  org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:461)
  at
 
 org.apache.openjpa.jdbc.meta.ClassMapping.resolveNonRelationMappings(ClassMapping.java:895)
  at
 
 org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRepository.java:416)
  at
 
 org.apache.openjpa.meta.MetaDataRepository.preMapping(MetaDataRepository.java:768)
  at
 
 org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:657)
  at
 
 org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:417)
  at
 
 org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:388)
  at
 
 org.apache.openjpa.persistence.meta.MetamodelImpl.init(MetamodelImpl.java:85)
  at
 
 org.apache.openjpa.persistence.EntityManagerFactoryImpl.getMetamodel(EntityManagerFactoryImpl.java:346)
  at
 
 org.apache.openjpa.persistence.EntityManagerFactoryImpl.getMetamodel(EntityManagerFactoryImpl.java:60)
  ...
 
  When I use attributes in the class, this all works fine.
 
  Do I have to have matching field/column names in order to use this
  functionality in my orm.xml?
  Please let me know if more information would be helpful.
 
  Thanks,
  Kate
 
 

 /quote
 Quoted from:

 http://openjpa.208410.n2.nabble.com/Trouble-with-persistent-element-extended-schema-when-field-name-does-not-match-column-name-tp7586297p7586324.html


 _
 Sent from http://openjpa.208410.n2.nabble.com




Re: OpenJPA 2.3

2014-05-14 Thread Kevin Sutter
Hi John,
Yes, there is a 2.3.0 release of OpenJPA... We're working through the
issues of making this more public.  We dropped the ball at the end of the
release and we still have some cleanup...  We hope to get this all
straightened out by the end of the week.

Kevin




On Tue, May 13, 2014 at 2:53 AM, Boblitz John john.bobl...@bertschi.comwrote:

 Hello,

 I have heard that openJPA 2.3 is available, but there are no links / news
 on the Web Page regarding this.  Is 2.3 released?


 John
 
 Who is General Failure, and why is he reading my hard disk?






Re: Trouble with persistent element (extended schema) when field name does not match column name

2014-05-01 Thread Kevin Sutter
Have you tried turning on trace?  The simple column name mapping is part of
the spec, so that should work regardless.  Applying the externalizer is an
OpenJPA extension to the orm.xml, but it doesn't even seem like you are
getting that far.  Maybe the trace will help show where the processing is
going awry...  Good luck!

Kevin


On Wed, Apr 30, 2014 at 7:09 AM, Tierney, Mary K (GE Healthcare) 
kate.tier...@ge.com wrote:

 I have the following:

 public abstract class Person {
 ...
 protected Boolean isActive;
 ...
 }

 Person table with column IsInactiveFLAG - char(1)

 I am trying to use the Externalizer/Factory combo to transform the value
 into a Boolean for use in code.

 In my orm.xml file (using the extended schema), I have the following:

 basic name=isActive

 orm:column name=IsInactiveFLAG column-definition=char(1)/
 /basic
 openjpa:attributes

 openjpa:persistent name=isActive

   externalizer=InvertedYesNoMapper.toDbValue

   factory=InvertedYesNoMapper.toValue/
 /openjpa:attributes

 I get the following error at runtime:

 ...Person.isActive declares column isActive, but this column does not
 exist in table dbo.PERSON
 at
 org.apache.openjpa.jdbc.meta.MappingInfo.mergeColumn(MappingInfo.java:692)
 at
 org.apache.openjpa.jdbc.meta.MappingInfo.createColumns(MappingInfo.java:593)
 at
 org.apache.openjpa.jdbc.meta.ValueMappingInfo.getColumns(ValueMappingInfo.java:178)
 at
 org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy.map(StringFieldStrategy.java:84)
 at
 org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:146)
 at
 org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:82)
 at
 org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:496)
 at
 org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:461)
 at
 org.apache.openjpa.jdbc.meta.ClassMapping.resolveNonRelationMappings(ClassMapping.java:895)
 at
 org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRepository.java:416)
 at
 org.apache.openjpa.meta.MetaDataRepository.preMapping(MetaDataRepository.java:768)
 at
 org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:657)
 at
 org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:417)
 at
 org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:388)
 at
 org.apache.openjpa.persistence.meta.MetamodelImpl.init(MetamodelImpl.java:85)
 at
 org.apache.openjpa.persistence.EntityManagerFactoryImpl.getMetamodel(EntityManagerFactoryImpl.java:346)
 at
 org.apache.openjpa.persistence.EntityManagerFactoryImpl.getMetamodel(EntityManagerFactoryImpl.java:60)
 ...

 When I use attributes in the class, this all works fine.

 Do I have to have matching field/column names in order to use this
 functionality in my orm.xml?
 Please let me know if more information would be helpful.

 Thanks,
 Kate




Re: openjpa.jdbc.Schemas configuration property

2014-04-24 Thread Kevin Sutter
There are two properties with very similar names...

openjpa.jdbc.Schema
openjpa.jdbc.Schemas

The plural version allows for the list of schemas to be used schema
reflection.


On Wed, Apr 16, 2014 at 3:43 PM, apph k.pankow...@gmail.com wrote:

 According to the documentation:
 This property accepts a comma-separated list of schemas and tables

 However, when I'm trying to specify two schemas in the form like property
 name=openjpa.jdbc.Schema value=SCHEMA1,SCHEMA2/ i do not get any
 results. When I specify only one I'm getting the generated entities.
 I'm using Oracle database and
 org.apache.openjpa.jdbc.meta.ReverseMappingTool.

 I was checking the source code and I don't know how it can work as it goes
 down to this class:
 oracle.jdbc.driver.OracleDatabaseMetaData and there is this comparison:
 WHERE t.owner LIKE :1 where :1 is the passed schema value, so
 SCHEMA1,SCHEMA2. The values in the owner column are particular schema
 values: SYSTEM, SCHEMA1, SYSTEM, SCHEMA2, SCHEMA3, etc



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/openjpa-jdbc-Schemas-configuration-property-tp7586236.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Having trouble using extendable orm

2014-04-24 Thread Kevin Sutter
Sounds good, Kate.  We have already made the necessary updates to trunk...
Can you clarify what versions of OpenJPA you will be using so that we can
properly target those service streams?  Thanks.

Kevin


On Thu, Apr 24, 2014 at 10:22 AM, kate.tier...@ge.com wrote:

 Thanks for the quick reply. That allowed me to make some progress.
 My next challenge is to figure out how to use the externalizer and factory
 attributes in my orm.xml file.

 Thanks!

 quote author='Kevin Sutter'
 Hi Kate,
 It looks like some namespace changes were accidentally backed out of the
 documentation...  When the Apache projects were required to do a cms wiki
 update in early 2013, the namespace that we were using for these xsd files
 was removed.  We had to define a new namespace.  Try this in your xml
 instead...  (I highlighted the changes)

 entity-mappings xmlns=http://*openjpa.apache.org
 http://openjpa.apache.org*/ns/orm/extendable
 xmlns:openjpa=http://*openjpa.apache.org
 http://openjpa.apache.org*/ns/orm

 xmlns:orm=http://java.sun.com/xml/ns/persistence/orm;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 version=2.0

 I'm not positive that this change alone will get you what you are looking
 for...  But, try this first and let us know the results.

 If you want to know the background information on this change in
 namespaces, you can reference this JIRA:
 https://issues.apache.org/jira/browse/OPENJPA-2368

 FYI, as we are working to clean this up, we can make faster changes in
 trunk vs the 2.2.2 release.  You referenced the 2.2.2 documentation, so I'm
 assuming you are using the 2.2.2 release.  If you can experiment with
 trunk, the changes will come faster...  But, let us know the final release
 that you would need these changes in.  Thanks.

 Kevin


 On Wed, Apr 23, 2014 at 12:47 PM, Tierney, Mary K (GE Healthcare) 
 kate.tier...@ge.com wrote:

  I am trying to put together a prototype using an orm.xml file instead of
  using attributes. One of the features I would like to use is the
  @Externalizer/@Factory attributes. I have tried to follow the sample
  provided in the openjpa manual (
  http://openjpa.apache.org/builds/2.2.2/apache-openjpa/docs/manual.pdf),
  but I get an error during compile - Cannot find the declaration of
  element
  'entity-mappings'.
 
  Based on the sample provided in the manual, I am using the following:
 
  entity-mappings xmlns=http://www.apache.org/openjpa/ns/orm/extendable;
  xmlns:openjpa=http://www.apache.org/openjpa/ns/orm;
  xmlns:orm=http://java.sun.com/xml/ns/persistence/orm;
  xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
  version=2.0
 
  Can anyone provide any guidance on how to use this extendable schema?
  Should I be specifying the schema location? If so, what is the schema
  location?
 
  I am new to Java and OpenJPA, and am running out of search terms to
  Google.
 
  Any information you can provide would be appreciated.
 
  Thanks!
 
 
  Kate Tierney
  GE Healthcare IT
  Lead Software Engineer
 
  T: 802-859-6071
  E: kate.tier...@ge.commailto:kate.tier...@ge.com
  www.gehealthcare.comhttp://www.gehealthcare.com
 
  40 IDX Drive
  South Burlington, VT 05403
  General Electric Company, GE Healthcare
 
 

 /quote
 Quoted from:

 http://openjpa.208410.n2.nabble.com/Having-trouble-using-extendable-orm-tp7586277p7586278.html


 _
 Sent from http://openjpa.208410.n2.nabble.com




Re: Having trouble using extendable orm

2014-04-24 Thread Kevin Sutter
Excellent!  FYI, when replying to these posts, please remember to copy the
users@openjpa.apache.org list so that everyone can benefit.

Thanks, Kevin


On Thu, Apr 24, 2014 at 10:56 AM, Tierney, Mary K (GE Healthcare) 
kate.tier...@ge.com wrote:

  I was able to figure out how to get the externalizer/factory attributes
 to work in my orm.xml!



 Thank you so much for your reply to my initial post.



 Kate



 *From:* Kevin Sutter [mailto:kwsut...@gmail.com]
 *Sent:* Thursday, April 24, 2014 11:24 AM
 *To:* Tierney, Mary K (GE Healthcare); users@openjpa.apache.org
 *Subject:* Re: Having trouble using extendable orm



 Sounds good, Kate.  We have already made the necessary updates to
 trunk...  Can you clarify what versions of OpenJPA you will be using so
 that we can properly target those service streams?  Thanks.

 Kevin



 On Thu, Apr 24, 2014 at 10:22 AM, kate.tier...@ge.com wrote:

 Thanks for the quick reply. That allowed me to make some progress.
 My next challenge is to figure out how to use the externalizer and factory
 attributes in my orm.xml file.

 Thanks!

 quote author='Kevin Sutter'

 Hi Kate,
 It looks like some namespace changes were accidentally backed out of the
 documentation...  When the Apache projects were required to do a cms wiki
 update in early 2013, the namespace that we were using for these xsd files
 was removed.  We had to define a new namespace.  Try this in your xml
 instead...  (I highlighted the changes)

 entity-mappings xmlns=http://*openjpa.apache.org
 http://openjpa.apache.org*/ns/orm/extendable
 xmlns:openjpa=http://*openjpa.apache.org
 http://openjpa.apache.org*/ns/orm


 xmlns:orm=http://java.sun.com/xml/ns/persistence/orm;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 version=2.0

 I'm not positive that this change alone will get you what you are looking
 for...  But, try this first and let us know the results.

 If you want to know the background information on this change in
 namespaces, you can reference this JIRA:
 https://issues.apache.org/jira/browse/OPENJPA-2368

 FYI, as we are working to clean this up, we can make faster changes in
 trunk vs the 2.2.2 release.  You referenced the 2.2.2 documentation, so I'm
 assuming you are using the 2.2.2 release.  If you can experiment with
 trunk, the changes will come faster...  But, let us know the final release
 that you would need these changes in.  Thanks.

 Kevin


 On Wed, Apr 23, 2014 at 12:47 PM, Tierney, Mary K (GE Healthcare) 
 kate.tier...@ge.com wrote:

  I am trying to put together a prototype using an orm.xml file instead of
  using attributes. One of the features I would like to use is the
  @Externalizer/@Factory attributes. I have tried to follow the sample
  provided in the openjpa manual (
  http://openjpa.apache.org/builds/2.2.2/apache-openjpa/docs/manual.pdf),
  but I get an error during compile - Cannot find the declaration of
  element
  'entity-mappings'.
 
  Based on the sample provided in the manual, I am using the following:
 
  entity-mappings xmlns=http://www.apache.org/openjpa/ns/orm/extendable;
  xmlns:openjpa=http://www.apache.org/openjpa/ns/orm;
  xmlns:orm=http://java.sun.com/xml/ns/persistence/orm;
  xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
  version=2.0
 
  Can anyone provide any guidance on how to use this extendable schema?
  Should I be specifying the schema location? If so, what is the schema
  location?
 
  I am new to Java and OpenJPA, and am running out of search terms to
  Google.
 
  Any information you can provide would be appreciated.
 
  Thanks!
 
 
  Kate Tierney
  GE Healthcare IT
  Lead Software Engineer
 
  T: 802-859-6071
  E: kate.tier...@ge.commailto:kate.tier...@ge.com
  www.gehealthcare.comhttp://www.gehealthcare.com
 
  40 IDX Drive
  South Burlington, VT 05403
  General Electric Company, GE Healthcare
 
 

 /quote
 Quoted from:

 http://openjpa.208410.n2.nabble.com/Having-trouble-using-extendable-orm-tp7586277p7586278.html


 _
 Sent from http://openjpa.208410.n2.nabble.com





Re: Having trouble using extendable orm

2014-04-23 Thread Kevin Sutter
Hi Kate,
It looks like some namespace changes were accidentally backed out of the
documentation...  When the Apache projects were required to do a cms wiki
update in early 2013, the namespace that we were using for these xsd files
was removed.  We had to define a new namespace.  Try this in your xml
instead...  (I highlighted the changes)

entity-mappings xmlns=http://*openjpa.apache.org
http://openjpa.apache.org*/ns/orm/extendable
xmlns:openjpa=http://*openjpa.apache.org
http://openjpa.apache.org*/ns/orm

xmlns:orm=http://java.sun.com/xml/ns/persistence/orm;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
version=2.0

I'm not positive that this change alone will get you what you are looking
for...  But, try this first and let us know the results.

If you want to know the background information on this change in
namespaces, you can reference this JIRA:
https://issues.apache.org/jira/browse/OPENJPA-2368

FYI, as we are working to clean this up, we can make faster changes in
trunk vs the 2.2.2 release.  You referenced the 2.2.2 documentation, so I'm
assuming you are using the 2.2.2 release.  If you can experiment with
trunk, the changes will come faster...  But, let us know the final release
that you would need these changes in.  Thanks.

Kevin


On Wed, Apr 23, 2014 at 12:47 PM, Tierney, Mary K (GE Healthcare) 
kate.tier...@ge.com wrote:

 I am trying to put together a prototype using an orm.xml file instead of
 using attributes. One of the features I would like to use is the
 @Externalizer/@Factory attributes. I have tried to follow the sample
 provided in the openjpa manual (
 http://openjpa.apache.org/builds/2.2.2/apache-openjpa/docs/manual.pdf),
 but I get an error during compile - Cannot find the declaration of element
 'entity-mappings'.

 Based on the sample provided in the manual, I am using the following:

 entity-mappings xmlns=http://www.apache.org/openjpa/ns/orm/extendable;
 xmlns:openjpa=http://www.apache.org/openjpa/ns/orm;
 xmlns:orm=http://java.sun.com/xml/ns/persistence/orm;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 version=2.0

 Can anyone provide any guidance on how to use this extendable schema?
 Should I be specifying the schema location? If so, what is the schema
 location?

 I am new to Java and OpenJPA, and am running out of search terms to Google.

 Any information you can provide would be appreciated.

 Thanks!


 Kate Tierney
 GE Healthcare IT
 Lead Software Engineer

 T: 802-859-6071
 E: kate.tier...@ge.commailto:kate.tier...@ge.com
 www.gehealthcare.comhttp://www.gehealthcare.com

 40 IDX Drive
 South Burlington, VT 05403
 General Electric Company, GE Healthcare




Re: Java 8 support

2014-03-26 Thread Kevin Sutter
Hi Henno,
The JIRA you referenced is still the one for tracking the work...  Because
of the changes to the class file format with Java 8, we will need a new ASM
in order to build and enhance Entities with Java 8.  Some of the
infrastructure work was put in place to support a new version of ASM, but
we haven't moved to it yet.  We now have a dependency on the xbean shaded
version of ASM from the Geronimo project.  And, I just noticed this morning
that they are looking to upgrade their version in support of Java 8.  Once
that work is complete, then hopefully it will be relatively easy to change
the OpenJPA enhancement process to take advantage of the new ASM.

The other open switch is the Serp utility with Java 8.  We're not sure if
the class file format change for Java 8 is going to directly affect Serp or
not.  We're hoping that the ASM upgrade will alleviate necessary changes to
Serp.

Not sure of your availability and skills, but any assistance with this
activity would be appreciated.  I see that ASM 5.0.1 was recently released
in support of Java 8 [1].  So, skipping the xbean shading for now, if
someone wants to re-package OpenJPA with ASM 5.0.1, we could start to see
how big of an effort this will be.  Do not attempt to build OpenJPA with
Java 8.  Stick with Java 7 for building.  At this point, we are only
interested in allowing applications to be built with Java 8.  Good luck!

Thanks, Kevin


[1]  http://forge.ow2.org/projects/asm/


On Wed, Mar 26, 2014 at 9:59 AM, Henno Vermeulen he...@huizemolenaar.nlwrote:

 Yesterday Java 8 was officially released. When I try to compile and run my
 tests and application that use OpenJPA 2.3.0 with Java 8 I get errors (see
 below) when I try to enhance the entities or use the java agent.
 Are there plans to support Java 8 in the near future?

 I did find the following issue which was unfortunately last updated almost
 half a year ago: https://issues.apache.org/jira/browse/OPENJPA-2386

 Regards,
 Henno Vermeulen

 Java agent:

 431  olgaPersistenceUnit  WARN   [main] openjpa.Enhance - An exception was
 thrown while attempting to perform class file transformation on
 nl/hm/olga/core/entity/AbstractEntity:java.lang.IllegalArgumentException
 at org.apache.xbean.asm4.ClassReader.init(Unknown Source)
 at org.apache.xbean.asm4.ClassReader.init(Unknown Source)
 at org.apache.xbean.asm4.ClassReader.init(Unknown Source)
 at
 org.apache.openjpa.enhance.AsmAdaptor.toJava7ByteArray(AsmAdaptor.java:93)
 at
 org.apache.openjpa.enhance.AsmAdaptor.toByteArray(AsmAdaptor.java:78)
 at
 org.apache.openjpa.enhance.PCClassFileTransformer.transform0(PCClassFileTransformer.java:156)
 at
 org.apache.openjpa.enhance.PCClassFileTransformer.transform(PCClassFileTransformer.java:126)
 at
 sun.instrument.TransformerManager.transform(TransformerManager.java:188)
 at
 sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
 at java.lang.ClassLoader.defineClass1(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
 at
 java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
 at
 java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
 at
 java.net.URLClassLoader.access$100(URLClassLoader.java:73)
 at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
 at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
 at java.security.AccessController.doPrivileged(Native
 Method)
 at
 java.net.URLClassLoader.findClass(URLClassLoader.java:360)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
 at
 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
 at java.lang.ClassLoader.defineClass1(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
 at
 java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
 at
 java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
 at
 java.net.URLClassLoader.access$100(URLClassLoader.java:73)
 at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
 at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
 at java.security.AccessController.doPrivileged(Native
 Method)
 at
 java.net.URLClassLoader.findClass(URLClassLoader.java:360)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
 at
 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
 at
 

Re: Issue with OpenJPA default cache, use external cache

2014-03-11 Thread Kevin Sutter
Hi Alice,
OpenJPA's L2 Cache provider is pluggable.  Ehcache did provide a plugin for
their cache [1], but this was some time ago and I don't know if they have
kept it up-to-date.

WebSphere also provided a plugin for their Dynacache offering [2].  This
was introduced in the WAS v8.0 timeframe.  I'm not aware of any issues
related to this usage.

I am not aware of any memcache plugin.  But, since the cache plugin is
public from an OpenJPA perspective [3], there is nothing stopping anybody
from writing their own plugin.

Good luck,
Kevin

[1]  http://ehcache.org/documentation/integrations/openjpa-provider
[2]
http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/topic/com.ibm.websphere.nd.doc/ae/rdyn_openjpa.html
[3]
http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#ref_guide_cache


On Tue, Mar 11, 2014 at 11:04 AM, Alice ashanai...@yahoo.com wrote:

 Thank you Rick for your response. I will check again to make sure we have
 bi-directional relation. We see this issue only when the parent entity has
 been saved before the FK entity is saved. I will confirm the bi-directional
 relation.

 Is there a way to plug in an external cache regardless of the issue?

 best,

 Alice



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/Issue-with-OpenJPA-default-cache-use-external-cache-tp7586064p7586073.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Please update the website with 2.3.0 release

2014-03-07 Thread Kevin Sutter
Good catch, Rade.  This was missed with our release process for 2.3.0.  We
will get this cleaned up shortly (along with openjpa-2481).

Thanks,
Kevin


On Fri, Mar 7, 2014 at 6:21 AM, RadeMartinovic r...@rcub.bg.ac.rs wrote:

 I have not realized that 2.3.0 has been released for a while now. This is
 due
 to the website not being updated. Surely I am not the only one that checks
 the website for news and releases.

 The most important items to be updated are index.html, downloads.html and
 documentation.html.

 Please treat this with highest importance. I have made OPENJPA-2480 for
 tracking this request.

 Thank you,
 -- Rade



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/Please-update-the-website-with-2-3-0-release-tp7586050.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: [Open JPA 2.2.2] Missing SQL statements

2014-03-04 Thread Kevin Sutter
Hi Datin,
It sounds like you might be hitting a condition where OpenJPA doesn't
properly detect the FK's within your Entity definitions.  Reference this
JIRA for the problem description and a couple of potential workarounds.
Let us know if we're talking about the same issue and whether one of the
workarounds does the trick for you.  Thanks.

https://issues.apache.org/jira/browse/OPENJPA-1936

Kevin


On Tue, Feb 25, 2014 at 12:11 PM, Datin Benoit 
benoit.da...@thomson-networks.com wrote:

 Hi all,

 I'm facing a problem that I assume to be an openJPA bug concerning some
 missing SQL statements.
 I'm using open JPA 2.2.2 version

 First of all, my configuration in my persistence.xml file is the following:

 properties
 property name=openjpa.ConnectionFactoryProperties
 value=PrettyPrint=true, PrettyPrintLineLength=120, PrintParameters=true /
 property name=openjpa.InitializeEagerly value=false /
 property name=openjpa.Multithreaded value=false /
 property name=openjpa.DynamicEnhancementAgent
 value=true /
 property name=openjpa.RuntimeUnenhancedClasses
 value=unsupported /
 property name=openjpa.Log value=DefaultLevel=WARN,
 Runtime=ERROR, Tool=INFO /
 property name=openjpa.jdbc.MappingDefaults
 value=ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict
 /
 /properties

 Then, here are two classes B_ScheduleElement and B_ScheduleTrigger where
 generators strategy is used for primary keys generation

 B_ScheduleElement:

 @Entity
 @Table( name = schedule_element )
 @TableGenerator( name = scheduleElementIdGen, table = pk_generators,
 pkColumnValue = scheduleElementId, initialValue = 1, allocationSize = 10 )
 public class B_ScheduleElement implements Cloneable
 {
   /**
* The persistence identifier
*/
   @Id
   @GeneratedValue( strategy = GenerationType.TABLE, generator =
 scheduleElementIdGen )
   @Column( name = id, nullable = false, updatable = false )
   private long  id;

   /**
* The schedule element unique identifier.
*/
   private UUID  uuid;

   /**
* Trigger for schedule start
*/
   @OneToOne( cascade = CascadeType.ALL, orphanRemoval = true )
   @JoinColumn( name = plannedStartTriggerId )
   private B_ScheduleTrigger
 plannedStartTrigger = null;

   /**
* Trigger for schedule end
*/
   @OneToOne( cascade = CascadeType.ALL, orphanRemoval = true )
   @JoinColumn( name = plannedEndTriggerId )
   private B_ScheduleTrigger plannedEndTrigger
   = null;

   /**
* The non persistent planable associated to the schedule element.
*/
   @Transient
   private B_Planableplanable
  = null;

 }

 B_ScheduleTrigger

 /**
 *
  * B_ScheduleTrigger complex type.
 *
  */
 @Entity
 @Table( name = schedule_trigger )
 @TableGenerator( name = scheduleTriggerIdGen, table = pk_generators,
 pkColumnValue = scheduleTriggerId, initialValue = 1, allocationSize = 20 )
 @Inheritance( strategy = InheritanceType.JOINED )
 public abstract class B_ScheduleTrigger implements Cloneable
 {

   /**
* The persistence identifier
*/
   @Id
   @GeneratedValue( strategy = GenerationType.TABLE, generator =
 scheduleTriggerIdGen )
   @Column( name = id, nullable = false, updatable = false )
   private long id;

 }


 So, B_ScheduleElement has two attributes of B_ScheduleTrigger types.

 When I first create a B_ScheduleElement, no problem, B_ScheduleTrigger are
 correctly created before B_ScheduleElement.
 But in some cases I can't explain, when I want to modify a
 B_ScheduleTrigger of a B_ScheduleElement, I see that no new insert of
 B_ScheduleTrigger are done before the update of the B_ScheduleElement.

 I activate the log to see all SQL statements:

 When the problem occurs, I have the following log:

 173924  planning  TRACE  [Pool thread #1] openjpa.jdbc.SQL - t 26690957,
 conn 12233946 executing prepstmnt 8820448
 UPDATE schedule_element
 SET persistentPlanable = ?, plannedEndTriggerId = ?,
 plannedStartTriggerId = ?
 WHERE id = ?
 [params=(byte[]) [B@1b7faf, (long) 0, (long) 0, (long) 224]
 173924  planning  TRACE  [Pool thread #1] openjpa.jdbc.SQL - t 26690957,
 conn 12233946 [0 ms] spent
 173955  planning  TRACE  [Pool thread #1] openjpa.jdbc.SQL - t 26690957,
 conn 12233946 executing prepstmnt 82008
 DELETE FROM schedule_trigger_date
 WHERE id = ?
 [params=(long) 604]
 173955  planning  TRACE  [Pool thread #1] openjpa.jdbc.SQL - t 26690957,
 conn 12233946 [0 ms] spent
 173955  planning  TRACE  [Pool thread #1] openjpa.jdbc.SQL - t 26690957,
 conn 12233946 executing prepstmnt 2591188
 DELETE FROM schedule_trigger_duration
 WHERE id = ?
 [params=(long) 603]
 173955  planning  TRACE  [Pool thread #1] openjpa.jdbc.SQL - t 26690957,
 conn 12233946 [0 ms] spent
 173955  planning  TRACE  [Pool thread #1] openjpa.jdbc.SQL - t 26690957,
 conn 

Re: Using PostgreSQL sequences with db user restrictions

2014-01-31 Thread Kevin Sutter
It looks like this JIRA may help out in your situation...
https://issues.apache.org/jira/i#browse/OPENJPA-2450

Basically, by using this property, you're telling OpenJPA to butt out and
don't attempt to match up the sequence with the entity definition.

Good luck, Kevin


On Thu, Jan 30, 2014 at 9:03 AM, Kevin Sutter kwsut...@gmail.com wrote:

 Hi,
 It looks like you are experiencing the issue documented in
 https://issues.apache.org/jira/browse/OPENJPA-2196.  But, according to
 the commits on that JIRA and the level of OpenJPA you are running with
 (2.2.2), you should already have that fix...  And, according to your
 comment above, you are receiving the warning message mentioned in the
 JIRA...  It sounds like your scenario is causing a slightly different path
 to be followed and OpenJPA doesn't properly recover from this failing
 Alter Sequence command...

 I would suggest opening a child or related JIRA to 2196, referencing this
 discussion as background.

 Kevin


 On Wed, Jan 29, 2014 at 11:54 AM, Anja anja.limb...@it.nrw.de wrote:

 From what I understand I don't see a connection with OPENJPA-2069.

 The application works fine if the db user is the sequence owner.

 The exception only arises if the db user is not allowed to alter the
 sequence and thus the ALTER SEQUENCE statement fails.
 I had looked at this issue which might be related:
 https://issues.apache.org/jira/browse/OPENJPA-2196
 https://issues.apache.org/jira/browse/OPENJPA-2196
 The ALTER SEQUENCE statement fails and I get the warning mentioned in that
 discussion:

 https://issues.apache.org/jira/browse/OPENJPA-2196?focusedCommentId=13409478page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13409478
 
 https://issues.apache.org/jira/browse/OPENJPA-2196?focusedCommentId=13409478page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13409478
 

 But still Postgres doesn't seem to accept any more statements within the
 same transaction after the ALTER SEQUENCE statement and an exception is
 thrown at the following db statement.

 If ALTER SEQUENCE is avoided, the application also works fine.




 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/Using-PostgreSQL-sequences-with-db-user-restrictions-tp7585893p7585895.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.





Re: Running with Karaf and Spring-Data

2014-01-30 Thread Kevin Sutter
Hi Daniel,
OpenJPA is in the middle of parsing for persistent types.  And, while
parsing urls, it's coming across the one referenced in the exception
(bundle://143.10:1) that it can't read.  This looks to be related to some
osgi bundle.  Does that identifier mean anything to you?  Do you have your
entity classes specified in your persistence.xml?  Can you post your p.xml
file just to see if anything jumps out at us?

You're right that Spring does some classpath scanning, but it's still up to
OpenJPA to parse the Entity classes so that we can perform some byte-code
enhancement.

What else can you tell me about the environment?  It's Karaf, Spring, and
OpenJPA.  Anything else of interest?

Thanks,
Kevin


On Mon, Jan 27, 2014 at 4:47 PM, Daniel McGreal dan...@redbite.com wrote:

 Hi all.

 I started using Karaf 3.0.0 features for the Spring dependencies
 (3.1.4.RELEASE and OpenJPA 2.3.0).

 I now have an OpenJPA error:

 Exception in thread SpringOsgiExtenderThread-2
 org.springframework.beans.factory.BeanCreationException: Error creating
 bean with name 'itemRepository': Injection of persistence dependencies
 failed; nested exception is openjpa-2.3.0-r422266:1540826 nonfatal general
 error org.apache.openjpa.util.GeneralException: Resource does not exist:
 bundle://143.10:1
 at
 org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:343)
 at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
 at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
 at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
 at
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
 at
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
 at
 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
 at
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
 at
 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:589)
 at
 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925)
 at
 org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
 at
 org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
 at
 org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
 at
 org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
 at
 org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
 at java.lang.Thread.run(Thread.java:722)
 Caused by: openjpa-2.3.0-r422266:1540826 nonfatal general error
 org.apache.openjpa.util.GeneralException: Resource does not
 exist:bundle://143.10:1
 at
 org.apache.openjpa.meta.AbstractCFMetaDataFactory.getPersistentTypeNames(AbstractCFMetaDataFactory.java:635)
 at
 org.apache.openjpa.meta.MetaDataRepository.getPersistentTypeNamesInternal(MetaDataRepository.java:1478)
 at
 org.apache.openjpa.meta.MetaDataRepository.getPersistentTypeNames(MetaDataRepository.java:1470)
 at
 org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypesInternal(MetaDataRepository.java:1522)
 at
 org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypes(MetaDataRepository.java:1513)
 at
 org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypes(MetaDataRepository.java:1493)
 at
 org.apache.openjpa.persistence.meta.MetamodelImpl.init(MetamodelImpl.java:84)
 at
 org.apache.openjpa.persistence.EntityManagerFactoryImpl.getMetamodel(EntityManagerFactoryImpl.java:345)
 at
 org.apache.openjpa.persistence.EntityManagerFactoryImpl.getMetamodel(EntityManagerFactoryImpl.java:59)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:601)
 at
 org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:376)
 at
 

Re: Composite Primary Key with constraints

2014-01-30 Thread Kevin Sutter
Hi Mansour,
I agree that the message is messed up a bit...  This particular message is
used in a few different locations in the code.  If you have additional
context about when this is received (call stack, persistent operation,
etc), it would help with identifying the specific usage and get that
cleaned up.

Looking at your example, a couple of things jump out...

1)  In your PK class, your getter/setter methods don't match the strId
attribute (get/setMessage?).  These names need to follow standard java bean
conventions and need to match up.

2)  In your GeoAssociation class...  It looks like you want the ability to
setGeo and setStrId, but I don't see those methods defined.  You have them
defined (sort of, per my first comment) in your PK class.  But, you don't
have them defined in your GeoAssoc class.

That's all I've got at this point.
Kevin


On Wed, Jan 29, 2014 at 11:48 PM, Mansour Al Akeel 
mansour.alak...@gmail.com wrote:

 Hello all,

 I need to create a primary key in my tables, and set constrains on
 them. So I have few tables:

 1- Geo
 2- GeoAssociation

 For the GeoAssociation, I need a primary key GeoAssociationPK. The PK
 has a field, that HAS to be a geo_id. So here's the definition I
 have for GeoAssociation:



 @Embeddable
 public class GeoAssociationPK implements Serializable {

 private String strId;

 private Geo geo;

 @Column(name = str_id)
 public String getMessage() {
 return strId;
 }

 public void setMessage(String message) {
 this.strId = message;
 }

 @ManyToOne(optional = false)
 @Column(name = geo_id)
 public Geo getGeo() {
 return geo;
 }

 public void setGeo(Geo geoFrom) {
 this.geo = geoFrom;
 }

 @Override
 public boolean equals(Object obj) {
 throw new UnsupportedOperationException(Not implemented);
 }

 @Override
 public int hashCode() {
 throw new UnsupportedOperationException(Not implemented);
 }

 }



 This is how I define the GeoAssociation class:

 @Entity
 @Access(AccessType.PROPERTY)

 public class GeoAssoc {

 @EmbeddedId
 private GeoAssociationPK id = new GeoAssociationPK();

 private GeoAssocType type;

 @ManyToOne(fetch = FetchType.LAZY)
 @JoinColumn(name = type)
 public GeoAssocType getType() {
 return type;
 }

 public void setType(GeoAssocType value) {
 this.type = value;
 }

 public Geo getGeoFrom() {
 return this.id.getGeo();
 }

 @Override
 public boolean equals(Object obj) {
 throw new UnsupportedOperationException(Not implemented);
 }

 @Override
 public int hashCode() {
 throw new UnsupportedOperationException(Not implemented);
 }

 }


 The error I am getting when building with maven enhancer is:

 The id class specified by type class entities.geo.GeoAssoc does not
 match the primary key fields of the class.  Make sure your identity
 class has the same primary keys as your persistent type, including pk
 field types. Mismatched property: geo - [Help 1]

 I don't understand the error message or how to solve it. What I need
 is to be able to create and persist entity without having to
 explicitly create the PK.

 For example :
 GeoAssociation gs = new GeoAssociation();
 gs.setGeo(myGeo);
 gs.setStrId(someString);


 My question is how to achieve this, and resolve this error message ?


 Thank you in advance.



Re: Using PostgreSQL sequences with db user restrictions

2014-01-30 Thread Kevin Sutter
Hi,
It looks like you are experiencing the issue documented in
https://issues.apache.org/jira/browse/OPENJPA-2196.  But, according to the
commits on that JIRA and the level of OpenJPA you are running with (2.2.2),
you should already have that fix...  And, according to your comment above,
you are receiving the warning message mentioned in the JIRA...  It sounds
like your scenario is causing a slightly different path to be followed and
OpenJPA doesn't properly recover from this failing Alter Sequence
command...

I would suggest opening a child or related JIRA to 2196, referencing this
discussion as background.

Kevin


On Wed, Jan 29, 2014 at 11:54 AM, Anja anja.limb...@it.nrw.de wrote:

 From what I understand I don't see a connection with OPENJPA-2069.

 The application works fine if the db user is the sequence owner.

 The exception only arises if the db user is not allowed to alter the
 sequence and thus the ALTER SEQUENCE statement fails.
 I had looked at this issue which might be related:
 https://issues.apache.org/jira/browse/OPENJPA-2196
 https://issues.apache.org/jira/browse/OPENJPA-2196
 The ALTER SEQUENCE statement fails and I get the warning mentioned in that
 discussion:

 https://issues.apache.org/jira/browse/OPENJPA-2196?focusedCommentId=13409478page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13409478
 
 https://issues.apache.org/jira/browse/OPENJPA-2196?focusedCommentId=13409478page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13409478
 

 But still Postgres doesn't seem to accept any more statements within the
 same transaction after the ALTER SEQUENCE statement and an exception is
 thrown at the following db statement.

 If ALTER SEQUENCE is avoided, the application also works fine.




 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/Using-PostgreSQL-sequences-with-db-user-restrictions-tp7585893p7585895.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: JPA Criteria API query - sorting by number of elements in collection

2014-01-09 Thread Kevin Sutter
Glad to hear that you worked through the problem. Thanks for letting us
know your solution.

Kevin


On Thu, Jan 9, 2014 at 5:05 AM, wlad vvo...@yahoo.com wrote:

 Yes, it does work, but with that query I am getting that extra data in
 result
 - number of comments. And I need to get result in a form of list of Post
 objects (ListPost).

 In the meantime I have found a way to build this query using JPA Criteria
 API:

 CriteriaBuilder cb = em.getCriteriaBuilder();
 CriteriaQueryPost cq = cb.createQuery(Post.class);
 RootPost p = cq.from(Post.class);
 cq.select(p);

 cq.orderBy(cb.desc(cb.size(p.CollectionCommentget(comments;

 Query q = em.createQuery(cq);
 ListPost resultList = (ListPost) q.getResultList();

 Anyway, thanks for reply.



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/JPA-Criteria-API-query-sorting-by-number-of-elements-in-collection-tp7585829p7585832.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: JPA Criteria API query - sorting by number of elements in collection

2014-01-08 Thread Kevin Sutter
Going back to your JPQL example, doesn't this work:

SELECT p, SIZE(p.comments) as c
FROM Post p
ORDER BY c DESC


On Wed, Jan 8, 2014 at 4:27 PM, wlad vvo...@yahoo.com wrote:

 I am having problem with building a query with JPA Criteria API.

 Entities and significant properties:

 @Entity
 public class Post {
 @Id int id;
 @OneToMany (mappedBy = post) SetComment comments;
 //...
 }

 @Entity
 public class Comment {
 @Id int id;
 @ManyToOne Post post;
 //...
 }
 I need a query that will return all posts from db ordered by number of
 comments (`OneToMany` relation in `Post`).
 At first I thought this can be implemented with `JPQL` like:

 SELECT p
 FROM Post p
 ORDER BY SIZE(p.comments) DESC

 But function `SIZE(...)` can not be used to be ordered by it in `JPQL`.

 So, I found about `JPA Criteria API`, and tried following:

 CriteriaBuilder cb = em.getCriteriaBuilder();
 CriteriaQueryPost cq = cb.createQuery(Post.class);
 RootPost p = cq.from(Post.class);
 cq.select(p);
 cq.orderBy(cb.desc(p.get(comments)));
 ListPost resultList = em.createQuery(cq).getResultList();

 With this query I am not getting proper results. I am aware that I am
 missing getting `size` of the set 'comments', but don't know how to add
 that
 part. I am not really familiar with `JPA Criteria API`. How should this
 query look to get all posts ordered by size of its `comments` field(set)?



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/JPA-Criteria-API-query-sorting-by-number-of-elements-in-collection-tp7585829.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: OpenJPA not generating/mapping DB tables from EJB entities

2013-12-09 Thread Kevin Sutter
Hi wlad,
OpenJPA needs a connection to the database in order to create the database
tables.  This posted exception indicates a problem with getting a
connection:

 [java] openjpa-2.2.0-r422266:1244990 nonfatal general error
org.apache.openjpa.persistence.PersistenceException: There were errors
initializing your configuration: openjpa-2.2.0-r422266:1244990 fatal user
error org.apache.openjpa.util.UserException: A connection could not be
obtained for driver class null and URL null.  You may have specified an
invalid URL.

According to your persistence.xml, you are trying to access this datasource:
jta-data-sourceVezbe09DS/jta-data-source

And, it looks like you are attempting to define this datasource via TomEE
configuration.

I am not a TomEE expert, but it would seem that you have an issue with
defining this Vezbe09DS in the TomEE jndi name space.  Normally, the
jta-data-source would be qualified via the jdbc namespace, something like
this:  jdbc/Vezbe09DS.  Or, if TomEE supports indirect references, then you
would use this namespace:  java:comp/env/jdbc/Vezbe09DS.

OpenJPA is dependent on your datasource configuration.  If you indicate
that the jndi name is Vezbe09DS, then that's the only jdni location OpenJPA
will look.  When this fails, then OpenJPA will attempt to use alternate
property settings to find an appropriate database (ie. javax.persistence.*
properties).  That's why the error message says it can't find a driver
class or URL property...

Good luck!
Kevin



On Mon, Dec 9, 2013 at 5:23 AM, wlad vvo...@yahoo.com wrote:

 Hi,
 I am trying to create database from annotated EJB entities. Using: Eclipse,
 Ant tool, Apache Tomee server, OpenJPA, JEE/EJB's, MySQL, OpenJDK java 1.7.

 My app fails during injecting entity manager(that is suppose to trigger db
 creation following annotated entity classes). Some crucial app parts:

 *Exception i am getting looks like this:*

 prepare-database:
  [echo] Inserting default user into database.
  [java] Dec 09, 2013 9:45:29 AM org.apache.openejb.client.EventLogger
 log
  [java] INFO:
 RemoteInitialContextCreated{providerUri=http://127.0.0.1:8080/tomee/ejb}
  [java] Bean found
  [java] Exception in thread main javax.ejb.EJBException: The bean
 encountered a non-application exception; nested exception is:
  [java] openjpa-2.2.0-r422266:1244990 nonfatal general error
 org.apache.openjpa.persistence.PersistenceException: There were errors
 initializing your configuration: openjpa-2.2.0-r422266:1244990 fatal user
 error org.apache.openjpa.util.UserException: A connection could not be
 obtained for driver class null and URL null.  You may have specified an
 invalid URL.
  [java] at

 org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:255)
  [java] at

 org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:241)
  [java] at

 org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:733)
  [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
 Method)
  [java] at

 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  [java] at

 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  [java] at java.lang.reflect.Method.invoke(Method.java:606)
  [java] at

 org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
  [java] at

 org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1671)
  [java] at

 org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:646)
  [java] at

 org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:203)
  [java] at

 org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
  [java] at

 org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
  [java] at

 org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
  [java] at

 org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createEntityManager(ReloadableEntityManagerFactory.java:160)
  [java] at

 org.apache.openejb.persistence.JtaEntityManagerRegistry.getEntityManager(JtaEntityManagerRegistry.java:115)
  [java] at

 org.apache.openejb.persistence.JtaEntityManager.getEntityManager(JtaEntityManager.java:80)
  [java] at

 org.apache.openejb.persistence.JtaEntityManager.persist(JtaEntityManager.java:126)
  [java] at

 rs.ac.uns.ftn.informatika.mbs2.vezbe09.primer01.server.session.InitBean.init(InitBean.java:22)
  [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
 Method)

 and so on 

 *Ant task for triggering 

Re: OpenJPA not generating/mapping DB tables from EJB entities

2013-12-09 Thread Kevin Sutter
No problem, wlad.  There are always beginner questions.  It's good to have
these documented for future newbies...  :-)


On Mon, Dec 9, 2013 at 9:41 AM, wlad vvo...@yahoo.com wrote:

 Hi Kevin,

 MY FAULT!!! I haven't created database before trying to map entities, and
 that's why i was getting this connection exception (I am new to JEE world
 and still learning).

 Above code and settings are fine. I thought that persistence
 provider(openJPA) is creating not only database tables, but database itself
 also. I thought that, because of given JdbcUrl property in the datasource
 definition (which contains db name). Obviously, i need to have created
 database, and persistence provider is creating just tables to already
 existing database. So, I have (explicitly) created database from mysql
 terminal command create database Vezbe09; , deployed my app, run above
 ant
 task that triggers openJPA, and I got tables in my database.

 (To be honest, I felt a little embarrassed when i realized how obvious
 thing
 i missed, so I thought it would be better to remove this topic)

 Anyway, thanks for explanations.




 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/Re-OpenJPA-not-generating-mapping-DB-tables-from-EJB-entities-tp7585739p7585741.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Build of intellij - asciidoctor plugin

2013-10-03 Thread Kevin Sutter
Hi Charles,
Wrong mailing list?  I don't think we (OpenJPA) can help with IntelliJ
plugins...  :-)


On Thu, Oct 3, 2013 at 7:35 AM, Charles Moulliard cmoulli...@gmail.comwrote:

 Hi,

 Is there a build of intellij - asciidoctor plugin ? Because If I try to
 install (from the code source - github) the project doing a zip file, that
 fails in IntelliJ 12.9.713

 Regards,

 Charles



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/Build-of-intellij-asciidoctor-plugin-tp7585031.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: OpenJPA 2.3.0 Release

2013-10-02 Thread Kevin Sutter
Hi Mark,
My original proposal [1] was to cut this OpenJPA 2.3.0 release and then do
JPA 2.1 in trunk.  Trunk would become 3.0.0-SNAPSHOT.  We do have an
existing JPA 2.1 sandbox, but we would merge the work that Pinaki has done
into trunk -- after we cut off the 2.3.0 release.  That would be the plan
anyway.

Kevin

[1]
http://openjpa.208410.n2.nabble.com/JPA-2-1-Development-Kickoff-td7584933.html


On Wed, Oct 2, 2013 at 12:58 AM, Mark Struberg strub...@yahoo.de wrote:

 Well, actually the most important thing in this release is the ASM4 fix.
 I plan to do much more releases on a much tighter schedule. We should get
 out bugfixes much quicker imo.

 I suspect that JPA-2.1 work is done in a branch for now and will finally
 end up being a 3.0.x release, right?
 Just for me to understand how much work is done in which place...

 LieGrue,
 strub




 - Original Message -
  From: Kevin Sutter kwsut...@gmail.com
  To: users@openjpa.apache.org; Mark Struberg strub...@yahoo.de;
 d...@openjpa.apache.org
  Cc:
  Sent: Monday, 30 September 2013, 18:31
  Subject: Re: OpenJPA 2.3.0 Release
 
  I think we need to get this out to the dev community as well...  Have you
  done any triage on the existing JIRAs for any show-stoppers?
 
  Thanks,
  Kevin
 
 
  On Sat, Sep 28, 2013 at 7:22 AM, Mark Struberg strub...@yahoo.de
 wrote:
 
   I've now created the 2.3.x branch for preparing the release.
   If you find any showstoppers in trunk then please think about pinging
 me.
 
   LieGrue,
   strub
 
 
 
 
   - Original Message -
From: Kevin Sutter kwsut...@gmail.com
To: users@openjpa.apache.org; Mark Struberg strub...@yahoo.de
Cc:
Sent: Monday, 23 September 2013, 14:57
Subject: Re: OpenJPA 2.3.0 Release
   
   T hanks, Mark.
   
Here's a starting point for our release process:
http://openjpa.apache.org/release-management.html
   
The steps you are interested in are under the Apache Nexus Release
process:
   
 
 http://openjpa.apache.org/apache-nexus-release-process-(1.2.x-2.1.x).html
   
Good luck!  There are several people that have done Apache OpenJPA
   releases
recently, so hopefully you'll get the assistance you need.  But, I
  do
   know
at least one of them is busy with JavaOne this week...
   
Kevin
   
   
On Sun, Sep 22, 2013 at 9:33 AM, Mark Struberg
  strub...@yahoo.de
   wrote:
   
 I can kick off all the maven parts of the release.
   
 I'm not sure what else do we need in terms of readme and JISA
  release
 notes housekeeping?
 Is there a wiki page or any other documentation about it
  somewhere?
   
 From my experience as Release Manager in other Apache projects I
  would
 have the following tasks on my TODO list. And some of them need
   community
 involvement prior to starting the actual release process
   
 * go through all open JIRA issues which have 2.3 as target
  release.
   There
 might be some of them which already got released. Then do the
  same for
   all
 open issues which show no apparent target version.
 * Check all resolved issues and file them into release notes.
 * pick some low hanging fruits in terms of open tasks and resolve
  them
   if
 possible.
 * run the TCK. As the current 2.3.0-SNAPSHOT is daily run by the
  TomEE
 build, I assume this is already covered. Please not that while
  I'm JCP
 member, I have not yet filed any JPA TCK NDA. So I cannot check
  this
   myself
 * create a 2.3.x maintenance branch.
   
 Any other tasks prior to firing up mvn release:prepare?
   
   
 LieGrue,
 strub
   
   
   
   
 - Original Message -
  From: Kevin Sutter kwsut...@gmail.com
  To: users@openjpa.apache.org
  Cc:
  Sent: Saturday, 21 September 2013, 23:10
  Subject: Re: OpenJPA 2.3.0 Release
 
  Hi Matias,
  Yes, we have plans for a 2.3.0 release.  I just don't
  know the
exact
 dates
  yet.  We need to cut a final major release for
  the JPA 2.0
level of
  functionality before we kick off the JPA 2.1 development
  activities.
I'm
  drafting a note to solicit for volunteers for this
  activity.  I would
 hope
  that this 2.3.0 release could be something that one of our
  committers
 could
  pickup rather quickly...
 
  Kevin
 
 
  On Mon, Aug 26, 2013 at 1:12 PM, Matias G
  matias.gavinow...@gmail.comwrote:
 
   Hi,
 
   I was wondering if anyone knows whether the 2.3.0 is
  planned and
what
 would
   the expected timeframe for that? I am very interested
  in the fix
for
 one
   particular issue
(https://issues.apache.org/jira/browse/OPENJPA-2318)
   which
   was solved just a few days ago.
 
   I upgraded to 2.3.0-SNAPSHOT and it works for me, but
  would find
it
 really
   helpful to know if there is a final release planned so
  I can in
turn
 plan

Re: Issue with OPENJPA_SEQUENCE_TABLE

2013-10-02 Thread Kevin Sutter
Hi Charles,
No idea why GenerationType.AUTO is not working for you on OpenJPA 2.2.0.
We have a large number of tests in our JUnit bucket that tests AUTO in a
very similar manner as your posted Entity definition.  And, these tests
work just fine.

Although the message text doesn't indicate this, the AUTO mode does require
the SEQUENCE table to exist.  If you are running with SynchronizeMappings,
then this table gets created for you automatically.  Otherwise, you have to
create it manually.  The GenerationType.SEQUENCE that eventually worked for
you doesn't require a separate table, so that might explain why that
scenario works.

Other than that, I'm not really sure.  If you can isolate the scenario to
simple junit then it might be easier to track the source of the issue.

Thanks,
Kevin


On Wed, Oct 2, 2013 at 8:10 AM, Charles Moulliard cmoulli...@gmail.comwrote:

 Being able to fix my problem with the following modification

 @Entity
 @SequenceGenerator(name=incidentSeq, sequenceName=INCIDENT_SEQ)
 @Table(name = T_INCIDENT)
 public class Incident extends Abstract implements Serializable {

 @Id
 @GeneratedValue(strategy=GenerationType.SEQUENCE,
 generator=incidentSeq)
 //@GeneratedValue(strategy=GenerationType.AUTO)
 @Column(name = INCIDENT_ID)
 private long incidentId;

 Question : Why  @GeneratedValue(strategy=GenerationType.AUTO) generates the
 error reported previously ?



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/Issue-with-OPENJPA-SEQUENCE-TABLE-tp7585016p7585018.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Issue with OPENJPA_SEQUENCE_TABLE

2013-10-02 Thread Kevin Sutter
Hi Charles,
I looked a bit at the code in the call stack...  The message is a little
misleading.  The reference to mapping is just a reference to the Entity
being mapped.  The code is then attempting to access the sequence defined
for this Entity's primary key in the OPENJPA_SEQUENCE_TABLE.  When it can't
find that sequence row, the code attempts to insert a new row for this
sequence.  When that operation fails, then you get the logged message:

Caused by: java.sql.SQLException: There is no row for mapping
com.mycompany.examples.persistence.part2.model.Incident in sequence table
OPENJPA_SEQUENCE_TABLE, and the attempt to insert a row has apparently
failed.

So, the message should probably say, There is no row for mapping *the
primary key for* com.mycompany.examples.persistence.part2.model.Incident
in sequence table
OPENJPA_SEQUENCE_TABLE, and the attempt to insert a row has apparently
failed.

This area of the code hasn't changed in a long time.  It's been pretty
standard processing for working with the sequence table since JPA 2.0 was
implemented.  When you say that previous releases worked okay, what release
of OpenJPA are you moving from?

I would also suggest tracing.  You can turn on OpenJPA tracing.  It's not
the best, but we do log all of the SQL that we generate and issue to the
database.  That might give a clue to which database and which table is
being used for each of these operations.  Maybe the schema name is
different from what's expected, or something similar?

What database is being used?  Tracing at the database level may also be
interesting and help figure out the source.

Like I mentioned, this code path has been pretty solid.  And, the junit
buckets are run constantly against all releases of OpenJPA.  I'm not aware
of any issues in this area, but maybe there's something unique with your
environment that puts us down the wrong path.  Let us know what you find
out.

Thanks,
Kevin


On Wed, Oct 2, 2013 at 11:49 AM, Charles Moulliard cmoulli...@gmail.comwrote:

 As OpenJPA is deployed on Apache Karaf (OSGI container), that will be
 difficult to create a unit test. I will try to use junit + pax exam to
 create something that we could use to reproduce the issue.

 BTW, this issue was not there with previous releases of OpenJPA



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/Issue-with-OPENJPA-SEQUENCE-TABLE-tp7585016p7585024.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Connection is closed across multiple EntityManager instances in a JEE Container

2013-10-01 Thread Kevin Sutter
I was going to suggest that as well, Paulo, but Andrew indicated that this
same issue applies to Glassfish...  And, Andrew is using Postgres...  I
thought the resultSetHoldability is a DB2 only property...  Maybe Glassfish
and Postgres have similar functionality, but I kind of doubt it...

Andrew, can you verify my statements and your environment?


On Tue, Oct 1, 2013 at 9:44 AM, Paulo Borges abuda...@hotmail.com wrote:

 Andrew:

 In WebSphere under the custom properties for your datasource change the

 resultSetHoldability from 2 (CLOSE_CURSORS_AT_COMMIT) to 1
 (HOLD_CURSORS_OVER_COMMIT)

 and see if it solves your problem.

 
  Date: Tue, 1 Oct 2013 12:27:25 +0100
  From: and...@ahastie.net
  To: users@openjpa.apache.org
  Subject: Connection is closed across multiple EntityManager instances in
 a JEE Container
 
  Hi all,
 
  OK, I suspect what I need here is more along the lines of advice on how
  to proceed diagnosing a problem .
 
  I have a JEE EJB3 application which makes us of Statefull Session Beans
  where my EntityManager is rooted. Connections are non-XA and managed by
  the container (Glassfish or WebSphere) and transactions under JTA
 control.
 
  OpenJPA version = v2.1.1
  Persistence database = PostgreSQL 9.2
  OS = Linux and Windows 2008 Server
  JEE Container = Glassfish V3.2 and IBM WebSphere V8.5.5
 
  Here's the persistence.xml (stripped down for salient bits and removal
  of sensitive data items):-
 
  *?xml version=1.0 encoding=UTF-8 ?
  persistence 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_2_0.xsd;
  version=2.0
 
  persistence-unit name=... transaction-type=JTA
  description
  
  /description
 
 providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider
  jta-data-sourcejdbc/.../jta-data-source
  class./class
  *** class./class
  *
  properties
  property name=openjpa.TransactionMode value=managed/
 
  property name=openjpa.jdbc.DBDictionary
  value=postgres(SearchStringEscape=\)/
  /properties
  /persistence-unit
  /persistence*
 
 
  When stress testing the application, I see failures emanating from the
  underlying database connection associated with the EntityManager stating
  that the connection is closed. The problem only appears to show up
  when the application is under load with multiple session bean instances,
  but I can find no fixed pattern that triggers the error.
 
  Here's a snippet from the stack trace:-
 
 
 [#|2013-09-30T15:43:39.848+0100|SEVERE|glassfish3.1.2|com.rocketsoftware.ascentserver.dataaccess.catalog.JpaDAO|_ThreadID=34;_ThreadName=Thread-2;|JPA
  Nested Throwable: org.apache.openjpa.lib.jdbc
  .ReportingSQLException:*Connection closed* {SELECT t0.appcode_id,
  t0.asRecNoMax, t0.asTableType, t0.comment, t0.creationDate,
  t0.CULTURE_ID, t0.currentCycle, t0.DATASOURCE_ID, t0.dataSpecification,
  t0.efficiency, t0.help, t0.hostCodepage, t0.id, t0.indexReorgNeeded,
  t0.internalName, t0.lastModified, t0.lastModifyCommand,
  t0.lockTimestamp, t0.locked, t0.lockingUserID, t0.maxCycle, t0.panel,
  t0.password, t0.passwordProtected, t0.recordCount, t0.recordSize,
  t0.reservationLock, t0.reserved, t0.reservedTimestamp,
  t0.reservingUserID, t0.shareable, t0.tableName, t0.tableNamekey,
 t0.tablePr
  otected, t0.title, t0.usable, t0.writtenTo FROM ASCENTTABLE t0 WHERE
  t0.id = ?} [code=0, state=null]
  java.lang.RuntimeException:
  org.apache.openjpa.lib.jdbc.ReportingSQLException: Connection closed
  {SELECT t0.appcode_id, t0.asRecNoMax, t0.asTableType, t0.comment,
  t0.creationDate, t0.CULTURE_ID, t
  0.currentCycle, t0.DATASOURCE_ID, t0.dataSpecification, t0.efficiency,
  t0.help, t0.hostCodepage, t0.id, t0.indexReorgNeeded, t0.internalName,
  t0.lastModified, t0.lastModifyCommand, t0.lockTimestam
  p, t0.locked, t0.lockingUserID, t0.maxCycle, t0.panel, t0.password,
  t0.passwordProtected, t0.recordCount, t0.recordSize, t0.reservationLock,
  t0.reserved, t0.reservedTimestamp, t0.reservingUserID,
  t0.shareable, t0.tableName, t0.tableNamekey, t0.tableProtected,
  t0.title, t0.usable, t0.writtenTo FROM ASCENTTABLE t0 WHERE t0.id = ?}
  [code=0, state=null]
  at
 
 org.apache.openjpa.jdbc.kernel.FinderQueryImpl.execute(FinderQueryImpl.java:160)
  at
 
 org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getInitializeStateResult(JDBCStoreManager.java:566)
  at
 
 org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
  at
 
 org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:333)
  at
 
 org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:112)
  at
 
 org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
  at
  org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:1027)
  

Re: ClassNotFoundExceptions for Entity classes after bundle redeployment

2013-09-30 Thread Kevin Sutter
Hi Dirk,
Thanks for the memory refresh...  :-)  The JIRA you pointed out only
provides the deRegister() method.  There were no changes in OpenJPA to call
this directly.  It was provided for embedders of OpenJPA to clean up after
classloaders change.  Are you suggesting that Felix should change to call
this deRegister() method?  Or, are you asking for OpenJPA to be smarter on
when this deRegister processing could be done?  I'm not sure the latter is
possible...  Since we don't know when a classloader change is warranted or
not...

Just looking to understand what's being requested.  Thanks.

-- Kevin


On Mon, Sep 30, 2013 at 2:00 AM, Rudolph, Dirk
dirk.rudo...@t-systems.comwrote:

 And me again...

 I found an nearly exactly identical discussion in the archives [1] and the
 related ticket [2].

 So it seems to be necessary to fix this issue by calling
 PCRegistry.deRegister when persistence bundle state changes in OSGI
 frameworks (specially we are using Apache Felix)

 [1]

 http://mail-archives.apache.org/mod_mbox/openjpa-dev/200707.mbox/%3cfbb27544-a571-4c30-af39-e0822f81d...@gmail.com%3E

 [2]
 https://issues.apache.org/jira/browse/OPENJPA-285

 -Ursprüngliche Nachricht-
 Von: Rudolph, Dirk
 Gesendet: Samstag, 28. September 2013 17:38
 An: users@openjpa.apache.org
 Betreff: AW: ClassNotFoundExceptions for Entity classes after bundle
 redeployment

 Hi, me again.

 I have made an Heap dump and it confirms my assumption that only
 PCRegistry holds references to the entity classes. Each entity class occurs
 three times after the following procedure:

 1. Startup
 2. Invoke DB access
 3. Redeploy persistance bundle
 4. Invoke DB access
 5. Redeploy persistance bundle
 6. Invoke DB access

 All in all 27 entity classes are in the PCRegistry. What I'm doing wrong?

 Thanks agian,
 Dirk

 -Ursprüngliche Nachricht-
 Von: Rudolph, Dirk
 Gesendet: Samstag, 28. September 2013 08:19
 An: users@openjpa.apache.org
 Betreff: AW: ClassNotFoundExceptions for Entity classes after bundle
 redeployment

 Hi Kevin,

 we are using OpenJPA 2.2.2 with container-managed persistence with Apache
 Aries JPA container (1.1.0) and when the persistence bundle is redeployed
 the container deregisters the EMFs as expected (I think). The enhancement
 is done on build time and PCRegistry.register is called for each entity in
 static initializer as expected.

 I think the problem is that Felix instantiates a new ClassLoader when a
 bundle is redoplyed. All classes loaded with the new ClassLoader are not
 equal to the classes loaded with the old ClassLoader. These new classes get
 initialized and the static initializer puts them in the PCRegistry without
 removing instances of the previous ClassLoader. I checked our codebase
 whether any instance holds references to instances of our entities but
 couldn't find any. I'm not sure why the classes in PCRegistry don't get
 collected by the garbage collector when the bundle is stopped before
 update. Am I responsible for closing EM during deactivation of my
 persistence service or is this also done by the container when EMF is
 deregistered?

 ?xml version=1.0 encoding=UTF-8?
 persistence
 version=2.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_2_0.xsd;

 persistence-unit name=myUserBundlePU transaction-type=JTA
 descriptionPersistence Unit for user service. Uses container
 managed transactions./description

 providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider

 jta-data-source
 osgi:service/javax.sql.DataSource/(datasource-mode=jta)
 /jta-data-source
 non-jta-data-source
 osgi:service/javax.sql.DataSource/(datasource-mode=non-jta)
 /non-jta-data-source

 !-- Entity classes --
 classmy.user.impl.entities.UserProfileEntity/class
 classmy.user.impl.entities.NewsletterSubscriptionEntity/class
 classmy.user.impl.entities.NewsletterStateEntity/class
 classmy.user.impl.entities.ArticleEntity/class
 classmy.user.impl.entities.ArticleUserInformationEntity/class
 classmy.user.impl.entities.DistributionListEntity/class
 classmy.user.impl.entities.DistributionListUserEntity/class
 classmy.user.impl.entities.DistributionListFirmEntity/class
 classmy.user.impl.entities.FirmEntity/class
 exclude-unlisted-classestrue/exclude-unlisted-classes

 properties
 property name=openjpa.Log value=DefaultLevel=INFO,
 Runtime=INFO, SQL=INFO, Tool=INFO /
 /properties
 /persistence-unit
 /persistence

 Thanks so far,
 Dirk

 -Ursprüngliche Nachricht-
 Von: Kevin Sutter [mailto:kwsut...@gmail.com]
 Gesendet: Donnerstag, 26. September 2013 14:57
 An: users@openjpa.apache.org
 Betreff: Re

Re: OpenJPA 2.3.0 Release

2013-09-30 Thread Kevin Sutter
I think we need to get this out to the dev community as well...  Have you
done any triage on the existing JIRAs for any show-stoppers?

Thanks,
Kevin


On Sat, Sep 28, 2013 at 7:22 AM, Mark Struberg strub...@yahoo.de wrote:

 I've now created the 2.3.x branch for preparing the release.
 If you find any showstoppers in trunk then please think about pinging me.

 LieGrue,
 strub




 - Original Message -
  From: Kevin Sutter kwsut...@gmail.com
  To: users@openjpa.apache.org; Mark Struberg strub...@yahoo.de
  Cc:
  Sent: Monday, 23 September 2013, 14:57
  Subject: Re: OpenJPA 2.3.0 Release
 
 T hanks, Mark.
 
  Here's a starting point for our release process:
  http://openjpa.apache.org/release-management.html
 
  The steps you are interested in are under the Apache Nexus Release
  process:
 
 http://openjpa.apache.org/apache-nexus-release-process-(1.2.x-2.1.x).html
 
  Good luck!  There are several people that have done Apache OpenJPA
 releases
  recently, so hopefully you'll get the assistance you need.  But, I do
 know
  at least one of them is busy with JavaOne this week...
 
  Kevin
 
 
  On Sun, Sep 22, 2013 at 9:33 AM, Mark Struberg strub...@yahoo.de
 wrote:
 
   I can kick off all the maven parts of the release.
 
   I'm not sure what else do we need in terms of readme and JISA release
   notes housekeeping?
   Is there a wiki page or any other documentation about it somewhere?
 
   From my experience as Release Manager in other Apache projects I would
   have the following tasks on my TODO list. And some of them need
 community
   involvement prior to starting the actual release process
 
   * go through all open JIRA issues which have 2.3 as target release.
 There
   might be some of them which already got released. Then do the same for
 all
   open issues which show no apparent target version.
   * Check all resolved issues and file them into release notes.
   * pick some low hanging fruits in terms of open tasks and resolve them
 if
   possible.
   * run the TCK. As the current 2.3.0-SNAPSHOT is daily run by the TomEE
   build, I assume this is already covered. Please not that while I'm JCP
   member, I have not yet filed any JPA TCK NDA. So I cannot check this
 myself
   * create a 2.3.x maintenance branch.
 
   Any other tasks prior to firing up mvn release:prepare?
 
 
   LieGrue,
   strub
 
 
 
 
   - Original Message -
From: Kevin Sutter kwsut...@gmail.com
To: users@openjpa.apache.org
Cc:
Sent: Saturday, 21 September 2013, 23:10
Subject: Re: OpenJPA 2.3.0 Release
   
Hi Matias,
Yes, we have plans for a 2.3.0 release.  I just don't know the
  exact
   dates
yet.  We need to cut a final major release for the JPA 2.0
  level of
functionality before we kick off the JPA 2.1 development activities.
  I'm
drafting a note to solicit for volunteers for this activity.  I would
   hope
that this 2.3.0 release could be something that one of our committers
   could
pickup rather quickly...
   
Kevin
   
   
On Mon, Aug 26, 2013 at 1:12 PM, Matias G
matias.gavinow...@gmail.comwrote:
   
 Hi,
   
 I was wondering if anyone knows whether the 2.3.0 is planned and
  what
   would
 the expected timeframe for that? I am very interested in the fix
  for
   one
 particular issue
  (https://issues.apache.org/jira/browse/OPENJPA-2318)
 which
 was solved just a few days ago.
   
 I upgraded to 2.3.0-SNAPSHOT and it works for me, but would find
  it
   really
 helpful to know if there is a final release planned so I can in
  turn
   plan
 in advance for how long I could expect to keep using snapshot
  versions.
   
 I looked at previous release dates and found they've happened
 February-November-April, so I don't know if the next one
  would be
happening
 this year. In my search through the site I could not find info on
   future
 releases.
   
 If anyone can point me to the right resource/person/information,
  many
 thanks.
   
 Matias
   
   
 
 



Re: ClassNotFoundExceptions for Entity classes after bundle redeployment

2013-09-26 Thread Kevin Sutter
Hi Dirk,
Are you using container-managed persistence or application-managed
persistence?  That is, who is controlling the lifecycle of your EMFs and
EMs?  If the PCRegistry is continuing to grow and grow and grow, this
sounds like an EMF or EM leak where they are not getting properly closed.

What version of OpenJPA is in use?  In 2.2.0, OpenJPA put a feature in
place [1] that helps with resolving memory issues when failing to close
EMFs.

Another thing to look at is how you are enhancing your Entities for OpenJPA
monitoring.  Are you doing build-time enhancement or some type of runtime
enhancement?  Posting your persistence.xml would also be good.

-- Kevin

[1]  https://issues.apache.org/jira/browse/OPENJPA-2042


On Thu, Sep 26, 2013 at 3:52 AM, Rudolph, Dirk
dirk.rudo...@t-systems.comwrote:

 Hi all,



 we are using OpenJPA in our osgi environment (Apache Felix) and got some
 (non-deterministic ) ClassNotFoundExceptions caused by already closed jars.
 This occurs only when the persistence bundle we are using is redeployed.



 We mentioned that the PCRegistry.register method is invoked when our
 Entity-classes get instantiated. This works as expected. The meta data map
 of the Registry is filled and successfully passed through the
 MetadataRepository. After a redeployment this happens again and again so
 the map of registered metas in the PCRegistry grows and grows and contains
 classes referencing already disposed classloaders. When the registered
 metadata get used this can cause ClassNotFoundExceptions when an outdated
 classloader is access. I assume that this happens non-deterministic because
 the order of the data to iterate over isn't predictable. Is this diagnostic
 right?



 Should PCRegistry.deRegister be called when a bundle is stopped before
 update? Can this be done by any configuration?



 Thank's so far,




 Dirk Rudolph




 T-Systems Multimedia Solutions GmbH
 Organisationseinheit CCS
 Dirk Rudolph
 Software-Entwicklung, OCJP

 Hausanschrift: Riesaer Straße 5, 01129 Dresden
 Postanschrift: Postfach 10 02 24, 01072 Dresden
 +49 351 2820-5363   (Tel)
 E-Mail: dirk.rudo...@t-systems.com mailto:mdirk.rudo...@t-systems-mms.com
 
 Internet: http://www.t-systems-mms.com http://www.t-systems-mms.de/

 T-Systems Multimedia Solutions GmbH

 Aufsichtsrat: Klaus Werner (Vorsitzender)
 Geschäftsführung: Peter Klingenburg, Dr. Jens Nebendahl
 Handelsregister: Amtsgericht Dresden HRB 11433
 Sitz der Gesellschaft: Dresden
 Ust-IdNr.: DE 811 807 949








Re: Why would OpenJPA runtime claim an enhanced class is not enhanced?

2013-09-26 Thread Kevin Sutter
I know this sounds like a dumb answer, but any chance you have multiple
occurrences of demo.MarketData in your classpath?  Since you showed a javap
output of demo.MarketData, you definitely have a version that is enhanced,
but could your application accidentally be loading a different version?


On Thu, Sep 26, 2013 at 1:42 PM, Chris cwolf.a...@gmail.com wrote:

 This just started happening.  The code used to work, not it complains the
 class is not enhanced:

 openjpa-2.2.1-r422266:1396819 nonfatal user error 
 org.apache.openjpa.**persistence.ArgumentException:
 This configuration disallows runtime optimization, but the following listed
 types were not enhanced at build time or at class load time with a
 javaagent: 
 demo.MarketData
 demo.SampleData.
 at org.apache.openjpa.enhance.**ManagedClassSubclasser.**
 prepareUnenhancedClasses(**ManagedClassSubclasser.java:**115)
 at org.apache.openjpa.kernel.**AbstractBrokerFactory.**
 loadPersistentTypes(**AbstractBrokerFactory.java:**314)
 at org.apache.openjpa.kernel.**AbstractBrokerFactory.**
 initializeBroker(**AbstractBrokerFactory.java:**238)
 at org.apache.openjpa.kernel.**AbstractBrokerFactory.**newBroker(*
 *AbstractBrokerFactory.java:**212)
 at org.apache.openjpa.kernel.**DelegatingBrokerFactory.**
 newBroker(**DelegatingBrokerFactory.java:**156)
 at org.apache.openjpa.**persistence.**EntityManagerFactoryImpl.**
 createEntityManager(**EntityManagerFactoryImpl.java:**227)
 at org.apache.openjpa.**persistence.**EntityManagerFactoryImpl.**
 createEntityManager(**EntityManagerFactoryImpl.java:**154)
 at org.apache.openjpa.**persistence.**EntityManagerFactoryImpl.**
 createEntityManager(**EntityManagerFactoryImpl.java:**60)

 ...but it *is* enhanced:

 $ javap demo.MarketData \
 | grep implements | grep PersistenceCapable
 public class demo.MarketData extends java.lang.Object implements
 java.io.Serializable,org.**apache.openjpa.enhance.**PersistenceCapable{



Re: Entitiy not enhanced

2013-09-25 Thread Kevin Sutter
Hi,
I've replied privately to Divya on this topic, but I wanted to let everyone
else know that is following this thread...

The -javaagent and the use of the jdk tools to automatically hook in a
javaagent does have some potential limitations (as documented in the
OpenJPA manual).  These approaches for enhancing the entities should be
thought of for development and test environments.  OpenJPA does the best it
can to hook into the classloading mechanism via these approaches, but the
Java hooks are not fool-proof.  We can still miss some entity classes
depending on what gets loaded and when by the Java runtime.

To ensure that your entity classes are properly enhanced in all cases is
to either use build-time enhancement, or to use the application server
container classloader hook as defined by the Java EE specs.  I said all
cases in quotes because it seems that Divya has uncovered a condition with
the OSGi container in the WebSphere environment where an entity class may
be getting loaded without going through the enhancement process.  This is
considered a bug and will be pursued as such -- that is, it is not a
limitation of the enhancement processing.

Another useful link for enhancement processing is on our wiki:
http://openjpa.apache.org/entity-enhancement.html

Hope this helps,
Kevin


On Wed, Sep 25, 2013 at 10:38 AM, Leonardo K. Shikida shik...@gmail.comwrote:

 Hi

 I could not make the runtime enhancement work for me too, so I am manually
 enhancing during build time with a simple script.

 public static void main(String[] args) {

 CollectionFile files = FileUtils.listFiles(new
 File(baseClassDir), null, true);
 for(File file:files){
 String[] a = new String[3];
 a[0] = -d;
 a[1] = baseClassDir;
 a[2] = file.getAbsolutePath();
 org.apache.openjpa.enhance.PCEnhancer.main(a);
 }
 }

 I've also noticed some strange behaviour using java 7, specifically, both
 IBM and Oracle JVM 7 didn't enhance the source code, but only Oracle
 crashed my tomEE+ server when that happened ;-)

 Just in case...

 good luck

 Leo


 []

 Leo


 On Wed, Sep 25, 2013 at 12:15 PM, Divya K Konoor dikon...@in.ibm.com
 wrote:

 
 
  Hi,
 
  I tried by manually adding the java agent in my jvm options  -javaagent:/
  apache-openjpa-2.2.2/lib/openjpa-all-2.2.2.jar following examples 5.2 and
  5.3 under section 2.3 at
 
 
 http://openjpa.apache.org/builds/2.1.1/apache-openjpa/docs/ref_guide_pc_enhance.html#ref_guide_pc_enhance_build
  .
 
   But even that hasn't helped .I still get the entity not enhanced
 problem.
 
  Regards
  Divya
 
 
 
  From:   Divya K Konoor/India/IBM
  To: users-h...@openjpa.apache.org, dev-h...@openjpa.apache.org,
  Date:   09/25/2013 07:19 PM
  Subject:Entitiy not enhanced
 
 
  Hi,
 
  I use a container (Webshphere liberty that internally uses openjpa). I
 have
  multiple OSGi persistence bundles .Each has its own persistence unit ;
 all
  of these talk to the same database.The JPA entities bundled within each
  persistence bundle is defined under the class/class tag of the
  persistence.xml. Some of these entities have relationship or dependency
 on
  the entities bundled with another persistence bundle in which case the
  dependent entities are added in the class tag of the former's
  persistence.xml
 
  I see the following error message when I start my liberty server:
 
  This configuration disallows runtime optimization, but the following
 listed
  types were not enhanced at build time or at class load time with a
  javaagent: 
 
  [err] openjpa-2.2.1.1-SNAPSHOT-r422266:1431746 fatal user error
  org.apache.openjpa.persistence.ArgumentException: The type class
  com.xxx.ProbeConfiguration has not been enhanced.
  [err]   at org.apache.openjpa.meta.ClassMetaData.resolveMeta
  (ClassMetaData.java:1827)
  [err]   at org.apache.openjpa.meta.ClassMetaData.resolve
  (ClassMetaData.java:1801)
  [err]   at org.apache.openjpa.meta.MetaDataRepository.processBuffer
  (MetaDataRepository.java:826)
  [err]   at org.apache.openjpa.meta.MetaDataRepository.resolveMeta
  (MetaDataRepository.java:723)
  [err]   at org.apache.openjpa.meta.MetaDataRepository.resolve
  (MetaDataRepository.java:647)
  [err]   at
  org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal
  (MetaDataRepository.java:415)
  [err]   at org.apache.openjpa.meta.MetaDataRepository.getMetaData
  (MetaDataRepository.java:388)
  [err]   at org.apache.openjpa.meta.MetaDataRepository.resolveAll
  (MetaDataRepository.java:1990)
  [err]   at
  org.apache.openjpa.meta.MetaDataRepository.getQueryMetaDataInternal
  (MetaDataRepository.java:1968)
  [err]   at org.apache.openjpa.meta.MetaDataRepository.getQueryMetaData
  (MetaDataRepository.java:1955)
  [err]   at
  org.apache.openjpa.persistence.EntityManagerImpl.createNamedQuery
  (EntityManagerImpl.java:102
 
  There is a brief mention of this here (but it doesn't explain why):
 
 
 
 

Re: OpenJPA 2.3.0 Release

2013-09-23 Thread Kevin Sutter
Thanks, Mark.

Here's a starting point for our release process:
http://openjpa.apache.org/release-management.html

The steps you are interested in are under the Apache Nexus Release
process:
http://openjpa.apache.org/apache-nexus-release-process-(1.2.x-2.1.x).html

Good luck!  There are several people that have done Apache OpenJPA releases
recently, so hopefully you'll get the assistance you need.  But, I do know
at least one of them is busy with JavaOne this week...

Kevin


On Sun, Sep 22, 2013 at 9:33 AM, Mark Struberg strub...@yahoo.de wrote:

 I can kick off all the maven parts of the release.

 I'm not sure what else do we need in terms of readme and JISA release
 notes housekeeping?
 Is there a wiki page or any other documentation about it somewhere?

 From my experience as Release Manager in other Apache projects I would
 have the following tasks on my TODO list. And some of them need community
 involvement prior to starting the actual release process

 * go through all open JIRA issues which have 2.3 as target release. There
 might be some of them which already got released. Then do the same for all
 open issues which show no apparent target version.
 * Check all resolved issues and file them into release notes.
 * pick some low hanging fruits in terms of open tasks and resolve them if
 possible.
 * run the TCK. As the current 2.3.0-SNAPSHOT is daily run by the TomEE
 build, I assume this is already covered. Please not that while I'm JCP
 member, I have not yet filed any JPA TCK NDA. So I cannot check this myself
 * create a 2.3.x maintenance branch.

 Any other tasks prior to firing up mvn release:prepare?


 LieGrue,
 strub




 - Original Message -
  From: Kevin Sutter kwsut...@gmail.com
  To: users@openjpa.apache.org
  Cc:
  Sent: Saturday, 21 September 2013, 23:10
  Subject: Re: OpenJPA 2.3.0 Release
 
  Hi Matias,
  Yes, we have plans for a 2.3.0 release.  I just don't know the exact
 dates
  yet.  We need to cut a final major release for the JPA 2.0 level of
  functionality before we kick off the JPA 2.1 development activities.  I'm
  drafting a note to solicit for volunteers for this activity.  I would
 hope
  that this 2.3.0 release could be something that one of our committers
 could
  pickup rather quickly...
 
  Kevin
 
 
  On Mon, Aug 26, 2013 at 1:12 PM, Matias G
  matias.gavinow...@gmail.comwrote:
 
   Hi,
 
   I was wondering if anyone knows whether the 2.3.0 is planned and what
 would
   the expected timeframe for that? I am very interested in the fix for
 one
   particular issue (https://issues.apache.org/jira/browse/OPENJPA-2318)
   which
   was solved just a few days ago.
 
   I upgraded to 2.3.0-SNAPSHOT and it works for me, but would find it
 really
   helpful to know if there is a final release planned so I can in turn
 plan
   in advance for how long I could expect to keep using snapshot versions.
 
   I looked at previous release dates and found they've happened
   February-November-April, so I don't know if the next one would be
  happening
   this year. In my search through the site I could not find info on
 future
   releases.
 
   If anyone can point me to the right resource/person/information, many
   thanks.
 
   Matias
 
 



JPA 2.1 Development Kickoff

2013-09-21 Thread Kevin Sutter
Hi,
There have been several discussions on the OpenJPA forums [1, 2, ...] about
the support for JPA 2.1...  Instead of just talking about it, let's see if
we can get this development effort kick-started.  As you'll see, this will
be a major effort and we'll need help from more than just the core OpenJPA
team.  We'll need help for development, test, documentation, evangelism,
etc.

To get started, I created some JPA 2.1 pages on the OpenJPA wiki.  Some of
the pages still need some work, but I wanted to get something out before
JavaOne in order to generate some interest...

JPA 2.1 Tasks:  http://openjpa.apache.org/jpa-2.1-tasks.html
Main Roadmap:  http://openjpa.apache.org/jpa-2.1-roadmap.html

You'll notice there are a few preliminary items that will need to be done
before JPA 2.1 development can be performed in trunk.  One of the main
items is to create an OpenJPA 2.3.0 release (along with the associated
service stream).  I've heard from Mark that he might be interested in this
activity.  Once that is done, then we can start some of the other
preliminary development activities in trunk (java 7, jpa 2.1 interfaces,
tck setup, etc).

The rest of the tasks identified were compiled with some help from Pinaki.
Pinaki had started to experiment with JPA 2.1 in a sandbox.  Another
investigative piece of work is to evaluate that sandbox and pull in the
appropriate pieces to trunk.

If you are looking for general information on the JPA 2.1 features, here
are a couple of references.

JPA 2.1 Specification:  http://jcp.org/en/jsr/detail?id=338
JPA 2.1 Video:  http://www.youtube.com/watch?v=MhgzNT7p7wA

That's enough for this first note.  Take a look at the material.  Offer
suggestions, improvements, and ideas.  Most of all, offer up some time and
effort to help upgrade OpenJPA to the next JPA 2.1 specification level.

Thanks,
Kevin


[1]
http://openjpa.208410.n2.nabble.com/DISCUSSION-JPA-2-1-spec-implementation-tp7581978.html
[2]
http://openjpa.208410.n2.nabble.com/OpenJPA-support-for-JPA-2-1-when-tp7584157.html


Re: org.apache.openjpa.persistence.PersistenceException: null

2013-09-17 Thread Kevin Sutter
What method of enhancement is being used?  From the call stack, it looks
like you might be using the RuntimeUnenhancedClasses support which is not a
recommended practice [1].

org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:176)

[1]  http://openjpa.apache.org/entity-enhancement.html


On Tue, Sep 17, 2013 at 3:44 PM, Rick Curtis curti...@gmail.com wrote:

 What are the versions of JDK that you used on Windows / Linux... and what
 JDK did you use to build the application?


 On Tue, Sep 17, 2013 at 3:14 PM, Leonardo K. Shikida shik...@gmail.com
 wrote:

  Hi
 
  I have an tomee 1.5.2 + that runs perfectly on linux, but when I try to
 run
  from windows, it gives me the following error message (see stacktrace)
 
  My doubts are
 
  - what does it mean :-)
  - why only in windows
  - is there any way to deal with this?
 
  My feeling it that it's somehow related to the OpenJPA enhancement
 process,
  but I really don't have a clue here.
 
  TIA
 
  Leo
 
  Exception in thread main javax.ejb.EJBException: The bean encountered a
  non-application exception; nested exception is:
  openjpa-2.2.0-r422266:1244990 fatal general error
  org.apache.openjpa.persistence.PersistenceException: null
  at
 
 
 org.apache.openejb.core.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:363)
 
  at
 
 
 org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:283)
 
  at (...)at
  (...)
  Caused by: openjpa-2.2.0-r422266:1244990 fatal general error
  org.apache.openjpa.persistence.PersistenceException: null
  at
 
 
 org.apache.openjpa.enhance.ClassRedefiner.redefineClasses(ClassRedefiner.java:96)
 
  at
 
 
 org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:176)
 
  at
 
 
 org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:314)
 
  at
 
 
 org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:238)
 
  at
 
 
 org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212)
 
  at
 
 
 org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
 
  at
 
 
 org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
 
  at
 
 
 org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
 
  at
 
 
 org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createEntityManager(ReloadableEntityManagerFactory.java:160)
 
  at
 
 
 org.apache.openejb.persistence.JtaEntityManagerRegistry.getEntityManager(JtaEntityManagerRegistry.java:115)
 
  at
 
 
 org.apache.openejb.persistence.JtaEntityManager.getEntityManager(JtaEntityManager.java:80)
 
   (...)
  Caused by: java.lang.VerifyError
  at sun.instrument.InstrumentationImpl.retransformClasses0(Native
  Method)
  at
 
 
 sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:144)
 
  ... 52 more
 



 --
 *Rick Curtis*



Re: org.apache.openjpa.persistence.PersistenceException: null

2013-09-17 Thread Kevin Sutter
You would think so, but the call stack doesn't lie...  :-)


On Tue, Sep 17, 2013 at 4:18 PM, Rick Curtis curti...@gmail.com wrote:

 Since he is using tomee and OpenEJB shouldn't the container wire the
 enhancer in?


 On Tue, Sep 17, 2013 at 3:50 PM, Kevin Sutter kwsut...@gmail.com wrote:

  What method of enhancement is being used?  From the call stack, it looks
  like you might be using the RuntimeUnenhancedClasses support which is
 not a
  recommended practice [1].
 
 
 
 org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:176)
 
  [1]  http://openjpa.apache.org/entity-enhancement.html
 
 
  On Tue, Sep 17, 2013 at 3:44 PM, Rick Curtis curti...@gmail.com wrote:
 
   What are the versions of JDK that you used on Windows / Linux... and
 what
   JDK did you use to build the application?
  
  
   On Tue, Sep 17, 2013 at 3:14 PM, Leonardo K. Shikida 
 shik...@gmail.com
   wrote:
  
Hi
   
I have an tomee 1.5.2 + that runs perfectly on linux, but when I try
 to
   run
from windows, it gives me the following error message (see
 stacktrace)
   
My doubts are
   
- what does it mean :-)
- why only in windows
- is there any way to deal with this?
   
My feeling it that it's somehow related to the OpenJPA enhancement
   process,
but I really don't have a clue here.
   
TIA
   
Leo
   
Exception in thread main javax.ejb.EJBException: The bean
  encountered a
non-application exception; nested exception is:
openjpa-2.2.0-r422266:1244990 fatal general error
org.apache.openjpa.persistence.PersistenceException: null
at
   
   
  
 
 org.apache.openejb.core.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:363)
   
at
   
   
  
 
 org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:283)
   
at (...)at
(...)
Caused by: openjpa-2.2.0-r422266:1244990 fatal general error
org.apache.openjpa.persistence.PersistenceException: null
at
   
   
  
 
 org.apache.openjpa.enhance.ClassRedefiner.redefineClasses(ClassRedefiner.java:96)
   
at
   
   
  
 
 org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:176)
   
at
   
   
  
 
 org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:314)
   
at
   
   
  
 
 org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:238)
   
at
   
   
  
 
 org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212)
   
at
   
   
  
 
 org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
   
at
   
   
  
 
 org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
   
at
   
   
  
 
 org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
   
at
   
   
  
 
 org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createEntityManager(ReloadableEntityManagerFactory.java:160)
   
at
   
   
  
 
 org.apache.openejb.persistence.JtaEntityManagerRegistry.getEntityManager(JtaEntityManagerRegistry.java:115)
   
at
   
   
  
 
 org.apache.openejb.persistence.JtaEntityManager.getEntityManager(JtaEntityManager.java:80)
   
 (...)
Caused by: java.lang.VerifyError
at sun.instrument.InstrumentationImpl.retransformClasses0(Native
Method)
at
   
   
  
 
 sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:144)
   
... 52 more
   
  
  
  
   --
   *Rick Curtis*
  
 



 --
 *Rick Curtis*



Re: JDK 1.7 seems to be causing an issue with latest snapshot

2013-08-20 Thread Kevin Sutter
Thanks for the information, garpinc!  Very helpful information.

Kevin


On Tue, Aug 20, 2013 at 10:45 AM, garpinc garp...@yahoo.com wrote:

 Turns out adding jvm option -XX:+AlwaysLockClassLoader appears to resolve
 issue.

 From http://docs.oracle.com/javase/7/docs/technotes/guides/lang/cl-mt.html

 It says:
 Troubleshooting
 If your product ships and appears to have problems due to incomplete
 handling of critical sections, you can use a new VM flag
 -XX:+AlwaysLockClassLoader. This flag reverts to locking the class loader
 lock before invoking your custom class loader's findClass() or loadClass()
 method, even for class loaders that register as parallel capable.

 The correct fix however would be to follow the guidelines in that post.



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584744.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Custom ID Generator

2013-08-20 Thread Kevin Sutter
Hi Malte,
Welcome to OpenJPA!

Maybe this is old information since you have already been experimenting
with the id generation, but I would first point you at this information.
Basic id generation is documented here:
http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#jpa_overview_meta_gen

From here, there is some information on the various built-in generators:
http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#ref_guide_sequence

Since it sounds like you have a unique case for the table generator, you
might want to consider extending the OpenJPA table generator and substitute
your unique processing:

*You can use JPA SequenceGenerators to describe any built-in Seqs or your
own Seq implementation. Set the sequenceName attribute to a plugin string
describing your choice. *
* *

* *

* If specifying your own class name, you must include parentheses at the
end of the class name, even if you have no plugin properties to configure.
(E.g., sequenceName=com.example.SeqImpl(). *

http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#jpa_overview_mapping_sequence

Hope this helps!
Kevin


On Sun, Aug 18, 2013 at 1:06 PM, Malte malte.neum...@googlemail.com wrote:

 Hi !

 I'm new to JPA (and OpenJPA). For a new project i consider to use OpenJPA
 as the persistence layer. During my investigations, I came across a problem.

 The existing system uses a table id generator. The ID saved in the
 id-table is always the last used id. The OpenJPA table-id-generator assumes
 that this is the next available id. I can't change the behaviour of the old
 system, so I'm looking for a solution in the OpenJPA System.

 I've been looking for a way to implement a custom id generator, but i
 can't find any working example. Is it even possible to implement a custom
 generator?

 Regards
 Malte



Re: Postgresql and java.util.UUID

2013-06-26 Thread Kevin Sutter
Hi Robert,
This sounds like a good exercise...  As you have found out, OpenJPA does
not currently provide direct mappings for the uuid type in any database.
We support the String version of UUID generation [1], but not the UUID type
found in postgres or other databases.  This should not be a difficult
task.  Although you are interested in Postgres support, I would encourage
you to look at allowing this support to be extended to other databases that
might support a UUID type.

First off, I would reference this documentation [2].  Although brief, this
explains the type of field mapping that you are probably interested in.  I
would expect that a simple ValueHandler implementation would be sufficient,
but depending on the necessary interactions with the database a
FieldStrategy might be necessary.  I'd start with a ValueHandler though.

As the documentation suggests, I would first take a look at the
ValueHandlers we already have in place, such as the EnumValueHandler.
There are several ValueHandler examples in that
org.apache.openjpa.jdbc.meta.strats package.

We have quite an extensive junit bucket as well, so be sure to reference
the testcases relating to ValueHandlers.  Junits would be appreciated
(expected) with any type of proposed solution.

Thanks!  And, Good Luck!
Kevin

[1]
http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#jpa_overview_meta_gen
[2]
http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#ref_guide_mapping_custom_field


On Wed, Jun 26, 2013 at 9:23 AM, Robert Velter rob...@velter.de wrote:

 Hello,

 i'm currently using glassfish3 (eclipselink) with postgresql. There i
 have a converter for mapping java.util.UUID to the native database type
 uuid of postgres (including a converter initializer which
 automatically installs it on every session).

 Now i want to switch to tomee and look for documentation how to do this
 in openjpa. I already read the chapter about custom mappings in the
 reference guide, but miss somehow the big picture...

 Cheers, Robert

 --
 Robert Velter rob...@velter.de




Re: OpenJPA support for JPA 2.1: when?

2013-06-14 Thread Kevin Sutter
Hi Matthew,
I greatly appreciate your insights.  And, I'm 100% behind you on this.
OpenJPA has a great, large set of users.  We get feedback from all facets
of the industry and we try to respond to the best of our ability.  Like the
squeaky wheel, we pay the most attention to those areas requesting
attention.  As you've seen, I have tried to generate and gauge interest in
JPA 2.1.  Mark has expressed some interest and, of course, Pinaki has.
And, now your note is the strongest worded request for JPA 2.1.  So, it's
great to hear that there's finally some interest.

This is totally different from the JPA 2.0 effort.  When that one was
discussed on the OpenJPA forums, there was much more interest from a
development perspective with several individuals and teams stepping up --
coding, testing, id, promotion, etc.  For whatever reason, the interest in
JPA 2.1 is not as strong.  Since most of us have day jobs in addition to
contributing to open-source, we have to pick what areas to focus on.

If there is interest in kicking off a real development effort, then we
should probably move this conversation to the dev mailing list and get the
development community fired up.

Anybody else have input?

Kevin


On Thu, Jun 13, 2013 at 9:52 PM, Matthew Adams matt...@matthewadams.mewrote:

 responses inline...

 On Thu, Jun 13, 2013 at 2:27 PM, Kevin Sutter kwsut...@gmail.com wrote:

  Good question, Matthew.  This has been brought up a couple of different
  times...
 
  http://openjpa.208410.n2.nabble.com/JPA-2-1-td7215602.html
 
 
 http://openjpa.208410.n2.nabble.com/DISCUSSION-JPA-2-1-spec-implementation-td7581978.html
 
  So, there's been some interest, but not an overwhelming interest.  Not to
  the point of creating a team, figuring out the work effort, and divvying
 up
  the responsibilities.  Contrast that with the JPA 2.0 development effort,
  and there was overwhelming community support and participation.  So, I
  think there are a handful of us interested in a JPA 2.1 implementation,
 but
  more participation is required.
 
  Pardon my surprise, but that sounds just plain bad.  That kind of
 sentiment threatens to scare users away, IMHO.  I have always held OpenJPA
 in high esteem as one of the major, credible implementations because it's
 always been up to date WRT to the specs (and, let's not kid ourselves, it
 hails from Kodo JDO).  Frankly, the specs don't move very fast, and at
 least previews of them are available well in advance of the actual GA
 releases.


  Pinaki has went so far to create a sandbox and start experimenting with
 an
  implementation.  Again, he's a one-man show and can't do it all.  Well,
 he
  probably could, but it would require a bit of work...  :-)
 
  https://svn.apache.org/repos/asf/openjpa/sandboxes/21
 
  Well, I would have expected a team of folks on this, not just one.  After
 all, Pinaki was arguing for expanded fetch plan capabilities in the JPA
 expert group based on OpenJPA's current capabilities -- and rightfully so,
 I might add.

 Maybe we should resurrect that [DISCUSSION] topic


 I think you should.  Especially with any support customers you or the
 OpenJPA project sponsors may have.


  but I'm curious what
  features of JPA 2.1 are of most interest to you?  Or, is it just a matter
  of being consistent with the latest specification?
 
  One feature that's worth its development weight is fetch plans, which
 OpenJPA, thanks to its current fetch plan implementation, can implement
 fairly quickly.  Further, OpenJPA's fetch plan support exceeds JPA's
 requirement with fetch depth and recursion depth!

 Additionally, I just happen to be writing an advanced JPA course right now,
 and customers of this course want to use the JPA implementation in the
 course that they have settled on in their organization.  It just so happens
 that the maiden voyage of this course covers JPA 2.1 and is for a customer
 that is also an OpenJPA customer.  And they're large.  Now, I have to tell
 them Sorry, OpenJPA doesn't have plans to implement JPA 2.1.  Can you
 say, Bye bye, customer?  EclipseLink  DataNucleus already implement 2.1,
 and Hibernate's implementation is in progress.  If not for the technical
 reasons I gave above, then the need to remain competitive should be enough
 to have you assemble a crack 2.1 team ASAP.  Don't forget about BatooJPA
 making noise (claiming top performance, although I take that with a few
 grains of salt) and the NoSQL JPA implementations (DataNucleus, ObjectDB,
 and Kundera), not to mention the Spring Data projects.  Like it or not, you
 are beset on all sides with competition.

 Just my $0.02, which might just be worth around $0.029 with the interest
 I've accumulated since working with JDO-  JPA-style lightweight
 persistence since 1996 and with the expert groups since 2000.

 Thanks,
  Kevin
 
 
  On Thu, Jun 13, 2013 at 2:03 PM, Matthew Adams matt...@matthewadams.me
  wrote:
 
   When will OpenJPA support JPA 2.1?
  
   -matthew

Re: Please vote to publish standard JPA 2.0 2.1 jars to Maven

2013-06-13 Thread Kevin Sutter
Thanks for these pointers!

Matthew, do you know if similar JIRAs are in place for the other JSRs?
I've been looking for the API jars for several of the JSRs associated with
Java EE 7 and making them available via maven would be ideal.

Thanks,
Kevin


On Thu, Jun 13, 2013 at 10:02 AM, Francesco Chicchiriccò 
ilgro...@apache.org wrote:

 On 13/06/2013 16:55, Matthew Adams wrote:

 Please vote for these enhancement requests to get official JPA API Maven
 artifacts released.
 https://java.net/jira/browse/**JPA_SPEC-19https://java.net/jira/browse/JPA_SPEC-19(for
  JPA 2.0)
 https://java.net/jira/browse/**JPA_SPEC-60https://java.net/jira/browse/JPA_SPEC-60(for
  JPA 2.1)


 Done.
 Regards.

 --
 Francesco Chicchiriccò

 ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
 http://people.apache.org/~**ilgrosso/http://people.apache.org/~ilgrosso/




Re: Please vote to publish standard JPA 2.0 2.1 jars to Maven

2013-06-13 Thread Kevin Sutter
Hi guys,
I just found the maven repo on java.net:
https://maven.java.net/index.html#nexus-search;quick~javax

This looks to have the majority of the API jar files, except as you have
noted -- not javax.persistence.*...

I'm a member of the JPA EG, so I'll post the question there as well.

Thanks, Kevin


On Thu, Jun 13, 2013 at 10:15 AM, Kevin Sutter kwsut...@gmail.com wrote:

 Thanks for these pointers!

 Matthew, do you know if similar JIRAs are in place for the other JSRs?
 I've been looking for the API jars for several of the JSRs associated with
 Java EE 7 and making them available via maven would be ideal.

 Thanks,
 Kevin


 On Thu, Jun 13, 2013 at 10:02 AM, Francesco Chicchiriccò 
 ilgro...@apache.org wrote:

 On 13/06/2013 16:55, Matthew Adams wrote:

 Please vote for these enhancement requests to get official JPA API Maven
 artifacts released.
 https://java.net/jira/browse/**JPA_SPEC-19https://java.net/jira/browse/JPA_SPEC-19(for
  JPA 2.0)
 https://java.net/jira/browse/**JPA_SPEC-60https://java.net/jira/browse/JPA_SPEC-60(for
  JPA 2.1)


 Done.
 Regards.

 --
 Francesco Chicchiriccò

 ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
 http://people.apache.org/~**ilgrosso/http://people.apache.org/~ilgrosso/





Re: Please vote to publish standard JPA 2.0 2.1 jars to Maven

2013-06-13 Thread Kevin Sutter
Right.  Many groups require the individual API jar files instead of relying
on the humongous javaee-api jar.  So, I still think this is a valid
request.  I will keep pushing...  :-)

Kevin


On Thu, Jun 13, 2013 at 1:14 PM, Matthew Adams matt...@matthewadams.mewrote:

 It looks like the JEE 6  7 APIs, including JPA 2.0  2.1, were released,
 but I was more looking for an independent JPA jar.

 http://search.maven.org/#artifactdetails%7Cjavax%7Cjavaee-api%7C7.0%7Cjar

 http://search.maven.org/#artifactdetails%7Cjavax%7Cjavaee-api%7C6.0%7Cjar



 On Thu, Jun 13, 2013 at 12:47 PM, Kevin Sutter kwsut...@gmail.com wrote:

  Hi guys,
  I just found the maven repo on java.net:
  https://maven.java.net/index.html#nexus-search;quick~javax
 
  This looks to have the majority of the API jar files, except as you have
  noted -- not javax.persistence.*...
 
  I'm a member of the JPA EG, so I'll post the question there as well.
 
  Thanks, Kevin
 
 
  On Thu, Jun 13, 2013 at 10:15 AM, Kevin Sutter kwsut...@gmail.com
 wrote:
 
   Thanks for these pointers!
  
   Matthew, do you know if similar JIRAs are in place for the other JSRs?
   I've been looking for the API jars for several of the JSRs associated
  with
   Java EE 7 and making them available via maven would be ideal.
  
   Thanks,
   Kevin
  
  
   On Thu, Jun 13, 2013 at 10:02 AM, Francesco Chicchiriccò 
   ilgro...@apache.org wrote:
  
   On 13/06/2013 16:55, Matthew Adams wrote:
  
   Please vote for these enhancement requests to get official JPA API
  Maven
   artifacts released.
   https://java.net/jira/browse/**JPA_SPEC-19
  https://java.net/jira/browse/JPA_SPEC-19(for JPA 2.0)
   https://java.net/jira/browse/**JPA_SPEC-60
  https://java.net/jira/browse/JPA_SPEC-60(for JPA 2.1)
  
  
   Done.
   Regards.
  
   --
   Francesco Chicchiriccò
  
   ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
   http://people.apache.org/~**ilgrosso/
  http://people.apache.org/~ilgrosso/
  
  
  
 



 --
 mailto:matt...@matthewadams.me matt...@matthewadams.me
 skype:matthewadams12
 googletalk:matt...@matthewadams.me
 http://matthewadams.me
 http://www.linkedin.com/in/matthewadams



Re: OpenJPA support for JPA 2.1: when?

2013-06-13 Thread Kevin Sutter
Good question, Matthew.  This has been brought up a couple of different
times...

http://openjpa.208410.n2.nabble.com/JPA-2-1-td7215602.html
http://openjpa.208410.n2.nabble.com/DISCUSSION-JPA-2-1-spec-implementation-td7581978.html

So, there's been some interest, but not an overwhelming interest.  Not to
the point of creating a team, figuring out the work effort, and divvying up
the responsibilities.  Contrast that with the JPA 2.0 development effort,
and there was overwhelming community support and participation.  So, I
think there are a handful of us interested in a JPA 2.1 implementation, but
more participation is required.

Pinaki has went so far to create a sandbox and start experimenting with an
implementation.  Again, he's a one-man show and can't do it all.  Well, he
probably could, but it would require a bit of work...  :-)

https://svn.apache.org/repos/asf/openjpa/sandboxes/21

Maybe we should resurrect that [DISCUSSION] topic, but I'm curious what
features of JPA 2.1 are of most interest to you?  Or, is it just a matter
of being consistent with the latest specification?

Thanks,
Kevin


On Thu, Jun 13, 2013 at 2:03 PM, Matthew Adams matt...@matthewadams.mewrote:

 When will OpenJPA support JPA 2.1?

 -matthew

 --
 mailto:matt...@matthewadams.me matt...@matthewadams.me
 skype:matthewadams12
 googletalk:matt...@matthewadams.me
 http://matthewadams.me
 http://www.linkedin.com/in/matthewadams



Re: How to define a timeout for nativeQuery by OpenJPA 1.2.2

2013-05-28 Thread Kevin Sutter
Hi Yu Wang,
I'm not clear on what you are trying to demonstrate.  The OpenJPA junit
bucket does have some tests for the various timeout hints and their usage
with finders and queries.  If you can further explain what your expected
results should be (via a junit?), it would be helpful.  Thanks,

Kevin


On Mon, May 27, 2013 at 1:12 AM, yu wang wangy...@gmail.com wrote:

 *
 I found *
 *javax.persistence.query.timeout
  does not work.

 query = manager.createNativeQuery(sql, Mybean.class);

 query.setHint(openjpa.FetchPlan.LockTimeout, new Integer(3));
 query.setHint(javax.persistence.lock.timeout, new
 Integer(3));
 query.setHint(javax.persistence.query.timeout, new
 Integer(3));

 if (TsamLogger.isInfoEnabled(log)) {
   start_time = System.currentTimeMillis();
 }
 reslist = query.getResultList();

 *
 *Regards,
 Yu Wang
 *
 **



Re: Does Default entity listener working in openjpa 1.2.2 ?

2013-05-20 Thread Kevin Sutter
Hi Subash,
I am not aware of any issues associated with the default entity listeners.
We do have tests in our junit bucket for testing default entity listeners,
so I'm assuming things are working okay.  Can you provide more detail on
your environment, entity definitions, listener definitions, xml
configurations, etc?  A junit test would be the best way to demonstrate the
issue.  Thanks.

Kevin


On Sun, May 19, 2013 at 2:33 PM, Subash Chaturanga subash...@gmail.comwrote:

 Hi,
 Seems it is not. Does this default listener thing works in openjpa
 openjpa-1.2.2. I have a situation where I am forced to use 1.2.2 version
 (juddi 3.1.3 uses 1.2.2 openjpa).
 I tried the default listener and it complains I am duplicating the events
 in the listener class.  ** Is there any workaround to this.


 Caused by: openjpa-1.2.2-r422266:898935 nonfatal user error
 org.apache.openjpa.persistence.ArgumentException: Class
 org.wso2.juddi.TestJUDDIEventListener declares method postPersist as
 well as postPersist for handling the same POST_PERSIST callback.
 at

 org.apache.openjpa.persistence.MetaDataParsers.validateMethodsForSameCallback(MetaDataParsers.java:92)
 at

 org.apache.openjpa.persistence.XMLPersistenceMetaDataParser.startCallback(XMLPersistenceMetaDataParser.java:1643)
 at

 org.apache.openjpa.persistence.XMLPersistenceMetaDataParser.startSystemElement(XMLPersistenceMetaDataParser.java:476)
 at

 org.apache.openjpa.lib.meta.CFMetaDataParser.startElement(CFMetaDataParser.java:115)
 at

 org.apache.openjpa.lib.meta.XMLMetaDataParser.startElement(XMLMetaDataParser.java:432)
 at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
 at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
 Source)
 at org.apache.xerces.impl.xs.XMLSchemaValidator.emptyElement(Unknown
 Source)
 at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
 Source)
 at

 org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
 Source)
 at
 org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
 Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
 at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
 at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
 at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
 at

 org.apache.openjpa.lib.meta.XMLMetaDataParser.parseNewResource(XMLMetaDataParser.java:376)
 at

 org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:318)
 at

 org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:295)
 at

 org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:268)
 at

 org.apache.openjpa.persistence.PersistenceMetaDataFactory.parseXML(PersistenceMetaDataFactory.java:247)
 at

 org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaDataFactory.java:198)
 at

 org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:569)
 at

 org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:379)
 at

 org.apache.openjpa.meta.MetaDataRepository.getMetaDataLocking(MetaDataRepository.java:366)
 at

 org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:360)
 at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1133)
 at

 org.apache.openjpa.kernel.DelegatingBroker.newObjectId(DelegatingBroker.java:268)


 --
 Subash Chaturanga
 Sri Lanka

 Blog -  http://subashsdm.blogspot.com/
 Twitter - http://twitter.com/subash89



Re: OOM with JDBCConfigurationImpl holding 1+ GB of heap

2013-05-20 Thread Kevin Sutter
Hi Alejandro,
It looks like something is holding onto references...  How are you
enhancing your classes?  At build time?  Or, some other mechanism?

Does this memory leak happen with any of your configured databases?  Or,
just select ones?

This shouldn't make a difference, but specifying your Entity classes via
both class and the openjpa.MetaDataFactory property is overkill.  The
class elements are sufficient and is the standard, so I'd suggest
sticking with that mechanism and removing the openjpa.MetaDataFactory
property.

We do considerable memory leak testing both as a standalone JPA provider as
well as the JPA provider for WebSphere Application Server.  We could have
missed something due to your configuration requirements, but this looks to
be a pretty major leak...

Can you narrow down or simplify your scenario to the point of sharing a
project that demonstrates the leak?  Or, maybe there is memory data dumps
that can be shared to help diagnose the issue?

Kevin


On Fri, May 17, 2013 at 4:50 PM, Alejandro Abdelnur tuc...@gmail.comwrote:

 And  I'm back.

 It seems that removing runtime enhancement has some effect, but the heap
 keeps building up in the same spot.

 The following link is show where is the memory sink

   http://people.apache.org/~tucu/tmp/OpenJPALeak.png

 I'd appreciate any ideas/suggestions.

 Thanks

 Alejandro



 On Fri, May 10, 2013 at 10:11 AM, Kevin Sutter kwsut...@gmail.com wrote:

  It shoudn't...  But, with that flag set as supported, we can't be sure
  that the entities were actually enhanced at build time.  By setting this
  property to unsupported or removing it altogether, then if an
 unenhanced
  entity class is loaded, we'll log a message and quit processing.  So,
 let's
  go this route first and then we'll deal with any potential memory leak.
 
  Thanks, Kevin
 
 
  On Fri, May 10, 2013 at 12:05 PM, Alejandro Abdelnur tuc...@gmail.com
  wrote:
 
   I'm in the process of verifying if Kevin's suggestion fixes the
 problem.
  
   While making the necessary changes, I've notice we were already
 enhancing
   the classes at build time.
  
   If the classes were enhanced at build time, still would be we see the
  leak
   if the runtime enhancement flag is enabled?
  
   Thanks
  
  
   On Thu, May 9, 2013 at 9:15 AM, Alejandro Abdelnur tuc...@gmail.com
   wrote:
  
Thanks Kevin, will try that.
   
   
On Thu, May 9, 2013 at 8:59 AM, Kevin Sutter kwsut...@gmail.com
  wrote:
   
Don't use this:
   
property name=openjpa.RuntimeUnenhancedClasses
 value=supported/
   
That is probably your issue.  Reference this page for more
  information:
http://openjpa.apache.org/entity-enhancement.html
   
Good luck, Kevin
   
   
   
   
On Thu, May 9, 2013 at 10:17 AM, Alejandro Abdelnur 
 tuc...@gmail.com
wrote:
   
 Hi Rick,

 Thanks for looking into this, the persistence.xml file we are
 using
   is:




   
  
 
 https://github.com/apache/oozie/blob/trunk/core/src/main/resources/META-INF/persistence.xml

 The EMF is instatiated here:




   
  
 
 https://github.com/apache/oozie/blob/trunk/core/src/main/java/org/apache/oozie/service/JPAService.java#L156


 Thanks again.

 Alejandro



 On Thu, May 9, 2013 at 6:06 AM, Rick Curtis curti...@gmail.com
   wrote:

  Can we see the contents of your persistence.xml file?
 
 
  On Wed, May 8, 2013 at 6:34 PM, Alejandro Abdelnur 
   tuc...@gmail.com
  wrote:
 
   We are seeing this using OpenJPA 2.1.0 in Oozie.
  
   A JDBCConfigurationImpl seems to be holding a large amount of
   memory
 via
   its dataCacheTimeout (then listeners) instance variable
 keeping
  
   Class  # Objects  Used Heap   Retained
   Heap
  
   ---
  
   o.a.o.j.meta.MappingRepository  1,902 304,320
  904,410,184
   o.a.o.j.meta.ClassMapping   3,824 1,223,680
  105,073,624
  
   ---
  
  
   We are using a single EntityManagerFactory and we are closing
  all
   EntityManager instances correctly (via a command pattern).
  
   All caching settings are default ones.
  
   Any hint where to look would be appreciated it.
  
   Thanks
  
   Alejandro
  
 
 
 
  --
  *Rick Curtis*
 

   
   
   
  
 



Re: Persist detached entities into a memory database

2013-05-16 Thread Kevin Sutter
Sounds like you need different JPA Entity definitions.  If you used
timestamp generation when you first created/persisted them, but now you
want to persist these in a different datasource, then you'll need a
modified JPA Entity definition that no longer used timestamp id generation.

Kevin


On Thu, May 16, 2013 at 2:41 AM, Guillaume Chauvet 
guillaume.chau...@qualiformed.com wrote:

 Hello,

 If I use persist operation, OpenJPA throws :
 openjpa-2.2.2-QFD-r422266:1446687M nonfatal store error
 org.apache.openjpa.persistence.EntityExistsException: Attempt to persist
 detached object .x..InternalUser@26f50154.  If this is a new
 instance, make sure any version and/or auto-generated primary key fields
 are
 null/default when persisting.
 FailedObject: .x..InternalUser@26f50154

 If I use merge operation, OpenJPA throws :
 openjpa-2.2.2-QFD-r422266:1446687M fatal store error
 org.apache.openjpa.persistence.OptimisticLockException: Attempted to attach
 deleted instance type class .x..InternalUser with oid
 1359392486037000524.  If the instance is new, the version field should be
 left to its default value.
 FailedObject: .x..InternalUser@165f5a4

 Regards,



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/Persist-detached-entities-into-a-memory-database-tp7583921p7583923.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: OOM caused by OpenJPA

2013-05-10 Thread Kevin Sutter
Also, see this reference:
http://openjpa.208410.n2.nabble.com/OOM-with-JDBCConfigurationImpl-holding-1-GB-of-heap-td7583862.html


On Fri, May 10, 2013 at 10:00 AM, Rick Curtis curti...@gmail.com wrote:

 The attachment didn't come through. Can you post it elsewhere so we can
 view it? Also, post the contents of your persistence.xml file.

 Thanks,
 Rick


 On Fri, May 10, 2013 at 5:25 AM, Hovan Akelian hovan.akel...@gotocme.com
 wrote:

  Hello All, 
 
  ** **
 
  We are facing an issue related to OutOfMemoryError exception appearing
  intermittently. 
 
  ** **
 
  We installed a HeapDump analyzer to track the cause of the issue. The
  following screen appeared after choosing the dump file that we want to
  analyze:
 
  ** **
 
  
 
  The analyzer suspected a leak in
  /org/apache/openjpa/persistence/EntityManagerFactoryImpl  caused by
 openjpa
  internal implementation. Could this be the possible cause of our issue?
 If
  so, any suggestion on how to solve this issue?
 
  ** **
 
  Appreciate your help.
 
  ** **
 
  Thanks,
 
  *Hovan Akelian*
 
  ** **
 
  ** **
 



 --
 *Rick Curtis*



Re: OOM with JDBCConfigurationImpl holding 1+ GB of heap

2013-05-10 Thread Kevin Sutter
It shoudn't...  But, with that flag set as supported, we can't be sure
that the entities were actually enhanced at build time.  By setting this
property to unsupported or removing it altogether, then if an unenhanced
entity class is loaded, we'll log a message and quit processing.  So, let's
go this route first and then we'll deal with any potential memory leak.

Thanks, Kevin


On Fri, May 10, 2013 at 12:05 PM, Alejandro Abdelnur tuc...@gmail.comwrote:

 I'm in the process of verifying if Kevin's suggestion fixes the problem.

 While making the necessary changes, I've notice we were already enhancing
 the classes at build time.

 If the classes were enhanced at build time, still would be we see the leak
 if the runtime enhancement flag is enabled?

 Thanks


 On Thu, May 9, 2013 at 9:15 AM, Alejandro Abdelnur tuc...@gmail.com
 wrote:

  Thanks Kevin, will try that.
 
 
  On Thu, May 9, 2013 at 8:59 AM, Kevin Sutter kwsut...@gmail.com wrote:
 
  Don't use this:
 
  property name=openjpa.RuntimeUnenhancedClasses value=supported/
 
  That is probably your issue.  Reference this page for more information:
  http://openjpa.apache.org/entity-enhancement.html
 
  Good luck, Kevin
 
 
 
 
  On Thu, May 9, 2013 at 10:17 AM, Alejandro Abdelnur tuc...@gmail.com
  wrote:
 
   Hi Rick,
  
   Thanks for looking into this, the persistence.xml file we are using
 is:
  
  
  
  
 
 https://github.com/apache/oozie/blob/trunk/core/src/main/resources/META-INF/persistence.xml
  
   The EMF is instatiated here:
  
  
  
  
 
 https://github.com/apache/oozie/blob/trunk/core/src/main/java/org/apache/oozie/service/JPAService.java#L156
  
  
   Thanks again.
  
   Alejandro
  
  
  
   On Thu, May 9, 2013 at 6:06 AM, Rick Curtis curti...@gmail.com
 wrote:
  
Can we see the contents of your persistence.xml file?
   
   
On Wed, May 8, 2013 at 6:34 PM, Alejandro Abdelnur 
 tuc...@gmail.com
wrote:
   
 We are seeing this using OpenJPA 2.1.0 in Oozie.

 A JDBCConfigurationImpl seems to be holding a large amount of
 memory
   via
 its dataCacheTimeout (then listeners) instance variable keeping

 Class  # Objects  Used Heap   Retained
 Heap

 ---

 o.a.o.j.meta.MappingRepository  1,902 304,320 904,410,184
 o.a.o.j.meta.ClassMapping   3,824 1,223,680   105,073,624

 ---


 We are using a single EntityManagerFactory and we are closing all
 EntityManager instances correctly (via a command pattern).

 All caching settings are default ones.

 Any hint where to look would be appreciated it.

 Thanks

 Alejandro

   
   
   
--
*Rick Curtis*
   
  
 
 
 



Re: OOM with JDBCConfigurationImpl holding 1+ GB of heap

2013-05-09 Thread Kevin Sutter
Don't use this:

property name=openjpa.RuntimeUnenhancedClasses value=supported/

That is probably your issue.  Reference this page for more information:
http://openjpa.apache.org/entity-enhancement.html

Good luck, Kevin




On Thu, May 9, 2013 at 10:17 AM, Alejandro Abdelnur tuc...@gmail.comwrote:

 Hi Rick,

 Thanks for looking into this, the persistence.xml file we are using is:



 https://github.com/apache/oozie/blob/trunk/core/src/main/resources/META-INF/persistence.xml

 The EMF is instatiated here:



 https://github.com/apache/oozie/blob/trunk/core/src/main/java/org/apache/oozie/service/JPAService.java#L156


 Thanks again.

 Alejandro



 On Thu, May 9, 2013 at 6:06 AM, Rick Curtis curti...@gmail.com wrote:

  Can we see the contents of your persistence.xml file?
 
 
  On Wed, May 8, 2013 at 6:34 PM, Alejandro Abdelnur tuc...@gmail.com
  wrote:
 
   We are seeing this using OpenJPA 2.1.0 in Oozie.
  
   A JDBCConfigurationImpl seems to be holding a large amount of memory
 via
   its dataCacheTimeout (then listeners) instance variable keeping
  
   Class  # Objects  Used Heap   Retained Heap
   ---
  
   o.a.o.j.meta.MappingRepository  1,902 304,320 904,410,184
   o.a.o.j.meta.ClassMapping   3,824 1,223,680   105,073,624
   ---
  
  
   We are using a single EntityManagerFactory and we are closing all
   EntityManager instances correctly (via a command pattern).
  
   All caching settings are default ones.
  
   Any hint where to look would be appreciated it.
  
   Thanks
  
   Alejandro
  
 
 
 
  --
  *Rick Curtis*
 



Re: JDK 1.7 seems to be causing an issue with latest snapshot

2013-03-27 Thread Kevin Sutter
Rick,
Since you seemed to have a reproducible environment, does setting this
DynamicEnhancementAgent property to false get around the issue for you as
well?  If so, then it seems that we need a JIRA for this property
configuration and Java 7?

Thanks, Kevin

On Wed, Mar 27, 2013 at 10:50 AM, hvieren herman.vierende...@gmail.comwrote:

  pu_prprts.put(openjpa.DynamicEnhancementAgent,false);
  emf=Persistence.createEntityManagerFactory(pu_name,pu_prprts);

 solved the problem for me



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7583248.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: JDK 1.7 seems to be causing an issue with latest snapshot

2013-03-19 Thread Kevin Sutter
Hi,
Since we never got to the bottom of the original posting, can you expand on
your test environment?  Are you experiencing this issue with the OpenJPA
JUnit bucket?  Or, are you experiencing this with your own application?
How are you doing your Entity class enhancement processing?  Are you
running in JSE mode or within an application server?

OpenJPA is tested against both IBM and Sun JDKs on a continual basis and I
don't believe we've experienced any issues like this.  So, if we can figure
out an environment that reproduces the problem, it would help with finally
resolving it.  Thanks.

Kevin

On Mon, Mar 18, 2013 at 10:48 PM, Seyed kazemita...@gmail.com wrote:


 Hit the exact same problem here.
 Using jdk1.7.0_17
 OpenJPA 2.2.1
 Any advise?




Re: Fail to compile OpenJPA source

2013-03-14 Thread Kevin Sutter
Did you add the following stanza to your settings.xml file (per the
instructions on the wiki)?  If so, remove it...

settings
mirrors
mirror
idrepo.mergere.com/id
urlhttp://repo.mergere.com/maven2/url
mirrorOfcentral/mirrorOf
/mirror
/mirrors/settings

I have never added this stanza.  Actually, I don't even have a
~/.m2/settings.xml file -- never needed one.

If removal of this stanza allows you to build, then I'll update that page.
I really have no idea why that instruction is there.

Kevin

On Wed, Mar 13, 2013 at 11:29 PM, Chak Sun Leung tocsle...@me.com wrote:

 I wish to compile the latest OpenJPA source, and follow the instruction as
 stated in the following link:

 http://openjpa.apache.org/building.html

 However,
 still get the maven error, state that the following maven repo is not
 responding

 http://repo.mergere.com/maven2

 C:\work\osgi\apache-openjpa-2.2.1-sourcemvn package -DfailIfNoTests=false
 [INFO] Scanning for projects...
 Downloading:
 http://repo.mergere.com/maven2/org/apache/apache/7/apache-7.pom
 [ERROR] The build could not read 1 project - [Help 1]
 [ERROR]
 [ERROR]   The project org.apache.openjpa:openjpa-parent:2.2.1
 (C:\work\osgi\apache-openjpa-2.2.1-source\pom.xml) has 1 e
 rror
 [ERROR] Non-resolvable parent POM: Could not transfer artifact
 org.apache:apache:pom:7 from/to repo.mergere.com (htt
 p://repo.mergere.com/maven2): repo.mergere.com and 'parent.relativePath'
 points at wrong local POM @ line 26, column 13:
  Unknown host repo.mergere.com - [Help 2]
 [ERROR]
 [ERROR] To see the full stack trace of the errors, re-run Maven with the
 -e switch.
 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
 [ERROR]
 [ERROR] For more information about the errors and possible solutions,
 please read the following articles:
 [ERROR] [Help 1]
 http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
 [ERROR] [Help 2]
 http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
 C:\work\osgi\apache-openjpa-2.2.1-source

 Have any alternative maven repo site?


 Tom






Re: Not able to fetch the data from NDB cluster

2013-03-14 Thread Kevin Sutter
Hi Bunty,
Interesting configuration.  I have not used the MySQL clustering support...

property name=openjpa.BrokerFactory value=ndb /
property name=openjpa.ndb.connectString value=mysql-management2 /
property name=openjpa.ndb.database value=db /

The ndb on the BrokerFactory must be some alias, but it's not defined by
the standard OpenJPA code.  Without some special extension in the OpenJPA
bundle, this alias would not be recognized.  From googling, I found other
people have specified the full BrokerFactory name:

com.mysql.clusterj.openjpa.NdbOpenJPABrokerFactory

By specifying this special broker and making the necessary supporting class
files available to OpenJPA, then your other openjpa.ndb.* properties will
be recognized.

I'm not sure if any of this rambling directly affects the issue you are
having, but I'm trying to save other people the trouble of understanding
your persistence.xml...

The required use of this property normally indicates an error in the
application:
property name=openjpa.Multithreaded value=true/

EntityManagers, by definition, are single threaded and should not be
shared.  Using this property normally highlights an issue with sharing of
EMs.  If your app does not work without this property, then you should
re-examine your app to remove this EM sharing.  The use of this property is
unnecessarily slowing down your app due to all of the synchronization that
has to be done to share EMs.

Kind of strange to see eclipselink properties in an openjpa configuration:
property name=eclipselink.jdbc.batch-writing value=JDBC/
property name=eclipselink.jdbc.batch-writing.size value=1000/

It's also kind of unique to use both SynchronizeMappings and SchemaFactory,
but I would make the usage similar by adding the ForeignKey clause to
SynchronizeMappings:
property name=openjpa.jdbc.SynchronizeMappings
value=buildSchema(ForeignKeys=true)/

Finally, the NPE you are getting looks to be caused by an incorrect
configuration.  Since it looks like you are trying to override the
BrokerFactory, my guess is that something is not right with the MySQL
Cluster setup and configuration.  You might need to post your question to
the MySQL team...

Let us know what you figure out.
Thanks, Kevin

On Thu, Mar 14, 2013 at 8:47 AM, bunty gurjantsing...@gmail.com wrote:

 Hi

 I am getting the below given exception when I try to connect to NDB cluster
 using my java application.

 openjpa-2.2.1-r422266:1396819 nonfatal general error
 org.apache.openjpa.persistence.PersistenceException: null
 at

 org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:625)
 at
 org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:682)
 at

 org.apache.openjpa.kernel.QueryImpl.getOrderedParameterTypes(QueryImpl.java:1577)
 at

 org.apache.openjpa.kernel.DelegatingQuery.getOrderedParameterTypes(DelegatingQuery.java:396)
 at
 org.apache.openjpa.persistence.QueryImpl.getParamTypes(QueryImpl.java:648)
 at

 org.apache.openjpa.persistence.AbstractQuery.getDeclaredParameters(AbstractQuery.java:497)
 at

 org.apache.openjpa.persistence.AbstractQuery.getParameterValues(AbstractQuery.java:77)
 at
 org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:284)
 at
 org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:302)
 at com.cpt.calculations.SPYData.loadSPYData(SPYData.java:49)
 at com.cpt.calculations.SPYData.getInstance(SPYData.java:29)
 at

 com.cpt.calculations.CalculationsManager.performHistoricalCalculations(CalculationsManager.java:159)
 at

 com.cpt.calculations.CalculationsManager.start(CalculationsManager.java:369)
 at
 com.cpt.calculations.CalculationsManager.main(CalculationsManager.java:421)
 Caused by: java.lang.NullPointerException
 at

 org.apache.openjpa.kernel.ExpressionStoreQuery.newCompilation(ExpressionStoreQuery.java:154)
 at
 org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:672)
 at

 org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:654)
 at

 org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:620)
 ... 13 more


 The persistence file is given below.

 persistence xmlns=http://java.sun.com/xml/ns/persistence;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; version=1.0
 persistence-unit name=cpt transaction-type=RESOURCE_LOCAL
 provider org.apache.openjpa.persistence.PersistenceProviderImpl
 /provider
 classcom.calculations.className/class
 properties
 PrettyPrintLineLength=500/ --
 property name=openjpa.DetachState
 value=fetch-groups(DetachedStateField=true) /
 property name=openjpa.jdbc.SchemaFactory
 value=native(ForeignKeys=true)
 /
 property name=openjpa.AutoDetach value=commit /
 property name=openjpa.Multithreaded value=true/
 property name=openjpa.ConnectionUserName value=db /
 property name=openjpa.ConnectionPassword value=** /
 

Re: InvalidStateException

2013-03-12 Thread Kevin Sutter
Hi Jose,
I need to back up to your specific scenario...  Why are you calling
merge()?  To force an update?  The merge() method is not used to force an
update.  The merge() method is used to merge an entity into your
persistence context.  If the merged entity is a detached entity, it will
now be managed by the persistence context so that any changes will
eventually get pushed out to the database.  If the merged entity is a new
entity, then this entity will eventually get inserted into the database
(acts like a persist).  Since you are using @GeneratedValues, then in this
latter case, the new entity would not have an ID value filled in yet.

If your entity is already managed and part of the current persistence
context, then there is no need to call merge().  Any updates to that entity
will automatically be determined and committed to the database when the
transaction completes.

And, in one of your replies, you mention this process:
  FYI, if i create an object (new operator) with an existent id (in
database),change some field and then call my ejb for merge operation, this
works great.

So, I'm confused on your scenario and what the expected result should be...

Kevin

On Mon, Mar 11, 2013 at 4:33 PM, José Luis Cetina maxtorz...@gmail.comwrote:

 Anyone?


 2013/3/11 José Luis Cetina maxtorz...@gmail.com

  I tried now with 2.2.1 and the same result. With this is impossible to
  edit any entity.
 
  Some advice?
 
 
  2013/3/11 José Luis Cetina maxtorz...@gmail.com
 
  I added and get the same exception:
 
  openjpa-2.2.0-r422266:1244990 nonfatal user error
  org.apache.openjpa.persistence.InvalidStateException: Primary key field
  com.grupokx.model.core.MyClass.idTest of
  com.grupokx.model.core.MyClass@28e0f7f6 has non-default value. The
  instance life cycle is in PNewState state and hence an existing
 non-default
  value for the identity field is not permitted. You either need to remove
  the @GeneratedValue annotation or modify the code to remove the
 initializer
  processing.
   at
  org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:489)
  at
 org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:469)
   at
 
 org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignObjectId(JDBCStoreManager.java:740)
  at
 
 org.apache.openjpa.kernel.DelegatingStoreManager.assignObjectId(DelegatingStoreManager.java:135)
   at
 
 org.apache.openjpa.kernel.StateManagerImpl.assignObjectId(StateManagerImpl.java:612)
  at
 
 org.apache.openjpa.kernel.StateManagerImpl.preFlush(StateManagerImpl.java:2977)
   at org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:40)
  at
 
 org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(StateManagerImpl.java:1054)
   at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2112)
  at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:2072)
   at
 
 org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1990)
  at
 
 org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:527)
   at
 
 org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:512)
  at
 
 org.apache.geronimo.transaction.manager.TransactionImpl.beforePrepare(TransactionImpl.java:413)
   at
 
 org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:262)
  at
 
 org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:252)
   at
 
 org.apache.openejb.core.CoreUserTransaction.commit(CoreUserTransaction.java:57)
  at
 
 org.apache.openejb.core.transaction.EjbUserTransaction.commit(EjbUserTransaction.java:37)
   at
 
 org.apache.openejb.core.BaseContext$UserTransactionWrapper.commit(BaseContext.java:247)
  at
 
 com.grupokx.businesslayer.ejbs.examenesdiagnostico.ExamenesAplicadosFacade.editarBDTest(ExamenesAplicadosFacade.java:277)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at
 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at
 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:601)
   at
 
 org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
  at
 
 org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
   at
 org.apache.openejb.cdi.CdiInterceptor.invoke(CdiInterceptor.java:130)
  at
  org.apache.openejb.cdi.CdiInterceptor.access$000(CdiInterceptor.java:43)
   at org.apache.openejb.cdi.CdiInterceptor$1.call(CdiInterceptor.java:67)
  at
 
 org.apache.openejb.cdi.CdiInterceptor.aroundInvoke(CdiInterceptor.java:73)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at
 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at
 
 

Re: InvalidStateException

2013-03-12 Thread Kevin Sutter
Hi Jose,
Your scenario looks like the classic use of detached entities and merging
them back into a persistence context.  This pattern is used over and over
again by many customers.  Nothing is jumping out at me as to what the issue
could be.  There must be something unique to your scenario or environment
that is causing an issue.

What about your persistence.xml?  Can you post that?  Any chance you are
using some openjpa property that might be affecting this processing?

Kevin

On Tue, Mar 12, 2013 at 1:28 PM, José Luis Cetina maxtorz...@gmail.comwrote:

 This is the scenario:

 This is a webapplication, using JSF+EJB

 1. The webpage (jsf) call a method to an EJB, for get a List of existent
 entities from database.
 2. In EJB i get a list (ListMyObject) of entities let say
 (MyObject.class), i get them using a query.
 3. The ejb return a list of entities (2 entities for example) of course at
 this point the entities are sended by the ejb to the managedbean (then
 the entities are out of the persistence context  therefore the are
 dettached)
 4. Then in the managedbean in X method i do the follow:
  - Get 1 of the dettached entities of the list. (MyObject)
  - Change some attribute let say the DESCRIPTION attribute
  - The managedbean now CALL and EJB method for do an update of this
 entity.
 5. The EJB method receive 1 MyObject ( public void update(MyObject obj) )
 6. Then the EJB method need to call an update because the DESCRIPTION
 property has changed
 7. The method is like this:

public void update(MyObject obj){
 begin transaction...
 em.merge(obj);
 commit transaction...
}

 8. I get this error:
 openjpa-2.2.0-r422266:1244990 nonfatal user error org.apache.openjpa.
 persistence.InvalidStateException: Primary key field com.test.MyObject.idof
 com.test.MyObject@198e0705 has non-default value. The instance life cycle
 is in PNewState state and hence an existing non-default value for the
 identity field is not permitted. You either need to remove the
 @GeneratedValue annotation or modify the code to remove the initializer
 processing.



 Notes:

 1. Of course the id of the entity has a value because this was an entity
 that the EJB gave me (doing a query to database) and then the only change
 is the DESCRIPTION attribute, that's why i expect merge method to do an
 update because the ID HAS THE VALUE RETRIEVED FROM DATABASE.

 2. About i've commented beforeFYI, if i create an object (new
 operator) with an existent id (in database),change some field and then call
 my ejb for merge operation, this works great..
  This is a test that i did, i create a new object in my managedbean then
 and set the ID to any ID that exists in database then i set a description
 then call ejb and do a merge and this did an update.

 Example:

 MyMangedBean,

 public void someMethod(){
   MyObject obj = MyObject();
   obj.setId(1);//this id exist in the database
   obj.setDescription(NEW DESCRIPTION);
   ejb.update(obj);
 }

 3.The changes in the Object was made in the ManagedBean, thats why the
 managedbean pass the same object (that it retrieved) but with some
 attributes changes (like DESCRIPTION) and the the EJB only need to merge



 Thanks.

 2013/3/12 Kevin Sutter kwsut...@gmail.com

  Hi Jose,
  I need to back up to your specific scenario...  Why are you calling
  merge()?  To force an update?  The merge() method is not used to force an
  update.  The merge() method is used to merge an entity into your
  persistence context.  If the merged entity is a detached entity, it will
  now be managed by the persistence context so that any changes will
  eventually get pushed out to the database.  If the merged entity is a new
  entity, then this entity will eventually get inserted into the database
  (acts like a persist).  Since you are using @GeneratedValues, then in
 this
  latter case, the new entity would not have an ID value filled in yet.
 
  If your entity is already managed and part of the current persistence
  context, then there is no need to call merge().  Any updates to that
 entity
  will automatically be determined and committed to the database when the
  transaction completes.
 
  And, in one of your replies, you mention this process:
FYI, if i create an object (new operator) with an existent id (in
  database),change some field and then call my ejb for merge operation,
 this
  works great.
 
  So, I'm confused on your scenario and what the expected result should
 be...
 
  Kevin
 
  On Mon, Mar 11, 2013 at 4:33 PM, José Luis Cetina maxtorz...@gmail.com
  wrote:
 
   Anyone?
  
  
   2013/3/11 José Luis Cetina maxtorz...@gmail.com
  
I tried now with 2.2.1 and the same result. With this is impossible
 to
edit any entity.
   
Some advice?
   
   
2013/3/11 José Luis Cetina maxtorz...@gmail.com
   
I added and get the same exception:
   
openjpa-2.2.0-r422266:1244990 nonfatal user error

Re: openjpa, maven and persistence.xml. help me please

2013-02-19 Thread Kevin Sutter
definitely sounds like a maven pom.xml configuration issue...  Something
isn't getting passed from the parent to the sub-modules that is required
for this compile/enhance step... Good luck.

Kevin

On Tue, Feb 19, 2013 at 3:49 AM, Aitor Iturriondobeitia 
laudio.i...@gmail.com wrote:

 thanks
 i have more information about this.
 i think that is not jpa problem. My poersistencefile is into the META-INF.
 I think tha is maven problem.
 when i intall (compile) my applicaion without the parent it runs ok but
 when i intall from the parent it does't run
 what do you think about this? do you occur anythig?
 thanks


 2013/2/18 Kevin Sutter kwsut...@gmail.com

  Welcome to the OpenJPA project!  Depending on your environment, getting
 the
  Enhancement processing to find your persistence.xml can be tricky
  sometimes.  I'm assuming you have looked at the available documentation
 for
  getting this setup properly [1].  The key is probably in the error
 message
  you received:
 
  ..Ensure that you have a
  META-INF/persistence.xml file, that it is available in your classpath, or
  that the properties file you are using for configuration is available.
 
  The contents of your persistence.xml looks fine, so the issue is probably
  with just finding your persistence.xml.  You have to ensure that this is
  available via your classpath that is used for your enhancement
 processing.
  With maven, it's sometimes useful to run with the -X option to see how
 your
  properties, environment variables, and classpaths are getting setup.
 
  Another idea that is simple is to use the javaagent approach for getting
  the enhancement processing done.  This is especially useful for test
  purposes, but can also be used for jse production usage.
 
  Sorry that we don't have a definitive answer for you.  It looks like some
  experimentation and understanding of your specific environment will be
  required to get the enhancement done.  Good luck!  Please post back with
  either success or continued issues.  Thanks.
 
  This has nothing to do with your enhancement processing, but I would
  suggest adding another property to your persistence.xml which will help
  with foreign key processing:
  property name=openjpa.jdbc.SynchronizeMappings
  value=buildSchema(ForeignKeys=true)/
 
  Kevin
 
 
  [1]  http://openjpa.apache.org/entity-enhancement.html
 
  On Mon, Feb 18, 2013 at 10:37 AM, laudio.info laudio.i...@gmail.com
  wrote:
 
   Hello
   i am trying to make my fisrt openjpa project.
   i am using maven.
   i have create the persistence.xml file (bellow) but when i try to
 compile
   my projects appears one error:
   [INFO] [openjpa:test-enhance {execution: enhancer}]
   [INFO]
  
 
   [ERROR] FATAL ERROR
   [INFO]
  
 
   [INFO] MetaDataFactory could not be configured
   (conf.newMetaDataFactoryInstance() returned null). This might mean that
  no
   configuration properties were found. Ensure that you have a
   META-INF/persistence.xml file, that it is available in your classpath,
 or
   that the properties file you are using for configuration is available.
 If
   you are using Ant, please see the properties or propertiesFile
   attributes of the task's nested config element. This can also occur
 if
   your OpenJPA distribution jars are corrupt, or if your security policy
 is
   overly strict.
   [INFO]
  
 
   [INFO] Trace
   openjpa-2.1.1-r422266:1148538 fatal user error
   org.apache.openjpa.util.MetaDataException: MetaDataFactory could not be
   configured (conf.newMetaDataFactoryInstance() returned null). This
 might
   mean that no configuration properties were found. Ensure that you have
 a
   META-INF/persistence.xml file, that it is available in your classpath,
 or
   that the properties file you are using for configuration is available.
 If
   you are using Ant, please see the properties or propertiesFile
   attributes of the task's nested config element. This can also occur
 if
   your OpenJPA distribution jars are corrupt, or if your security policy
 is
   overly strict.
at
  
  
 
 org.apache.openjpa.meta.MetaDataRepository.initializeMetaDataFactory(MetaDataRepository.java:1904)
at
  
  
 
 org.apache.openjpa.meta.MetaDataRepository.endConfiguration(MetaDataRepository.java:1885)
at
  
  
 
 org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:518)
at
  
  
 
 org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:443)
  
   My persistence.xml file is into the META-INF directory and has this:
   ?xml version=1.0 encoding=UTF-8?
   persistence xmlns=http://java.sun.com/xml/ns/persistence;
  version=2.0
 persistence-unit name=example transaction-type=RESOURCE_LOCAL
  
  
 
 providerorg.apache.openjpa.persistence.PersistenceProviderImpl

Fwd: Error in EntityManager.persist () if the database already contains a row with id=0

2013-02-19 Thread Kevin Sutter
Forgot the users mailing list on this suggestion...

-- Forwarded message --
From: Albert Lee allee8...@gmail.com
Date: Mon, Feb 18, 2013 at 2:06 PM
Subject: Re: Error in EntityManager.persist () if the database already
contains a row with id=0
To: d...@openjpa.apache.org


Check this out:

http://people.apache.org/~mikedd/nightly.builds/apache-openjpa-2.3.0-SNAPSHOT/docs/docbook/manual.html#jpa_overview_mapping_sequence

sequence-generator has attribute int initialValue: The initial sequence
value.

Albert

On Mon, Feb 18, 2013 at 1:27 PM, Krishnaprasad Subbarao 
krishnapras...@in.ibm.com wrote:

 Hello,

 Following error occurs while I am trying to persist a record. The id field
 has  been assigned a default value (0) as per the guidelines.

 openjpa-2.2.1-r422266:1396819 fatal store error *
 org.apache.openjpa.persistence.RollbackException*: An object of type
 com.ibm.wdp.bss.party.entity.PartyObject with oid 0 already exists in
 this context; another cannot be persisted.
 FailedObject: com.ibm.wdp.bss.party.entity.PartyObject@7aa47aa4
 at org.apache.openjpa.persistence.EntityManagerImpl.commit(*
 EntityManagerImpl.java:594*)
 at com.ibm.test.jpa.JPAAddEntityTest.main(*
 JPAAddEntityTest.java:38*)
 Caused by: openjpa-2.2.1-r422266:1396819 nonfatal store error *
 org.apache.openjpa.persistence.EntityExistsException*: An object of type
 com.ibm.wdp.bss.party.entity.PartyObject with oid 0 already exists in
 this context; another cannot be persisted.
 FailedObject: com.ibm.wdp.bss.party.entity.PartyObject@7aa47aa4
 at org.apache.openjpa.kernel.BrokerImpl.checkForDuplicateId(*
 BrokerImpl.java:5080*)
 at org.apache.openjpa.kernel.BrokerImpl.persistInternal(*
 BrokerImpl.java:2653*)
 at org.apache.openjpa.kernel.BrokerImpl.persist(*
 BrokerImpl.java:2573*)
 at org.apache.openjpa.kernel.BrokerImpl.persist(*
 BrokerImpl.java:2556*)
 at org.apache.openjpa.kernel.SingleFieldManager.preFlushPC(*
 SingleFieldManager.java:800*)
 at org.apache.openjpa.kernel.SingleFieldManager.preFlush(*
 SingleFieldManager.java:621*)
 at org.apache.openjpa.kernel.SingleFieldManager.preFlush(*
 SingleFieldManager.java:589*)
 at org.apache.openjpa.kernel.SingleFieldManager.preFlush(*
 SingleFieldManager.java:505*)
 at org.apache.openjpa.kernel.StateManagerImpl.preFlush(*
 StateManagerImpl.java:3028*)
 at org.apache.openjpa.kernel.PNewState.beforeFlush(*
 PNewState.java:44*)
 at org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(*
 StateManagerImpl.java:1042*)
 at org.apache.openjpa.kernel.BrokerImpl.flush(*
 BrokerImpl.java:2114*)
 at org.apache.openjpa.kernel.BrokerImpl.flushSafe(*
 BrokerImpl.java:2074*)
 at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(*
 BrokerImpl.java:1992*)
 at org.apache.openjpa.kernel.LocalManagedRuntime.commit(*
 LocalManagedRuntime.java:81*)
 at org.apache.openjpa.kernel.BrokerImpl.commit(*
 BrokerImpl.java:1516*)
 at org.apache.openjpa.kernel.DelegatingBroker.commit(*
 DelegatingBroker.java:933*)
 at org.apache.openjpa.persistence.EntityManagerImpl.commit(*
 EntityManagerImpl.java:570*)
 ... 1 more

 The reason for this issue I found is, if the database which this object
 being persisted, contains a row with primary key as 0, then adding new
 record fails. Seems a duplicate primary key check is done when default
 value (0) is assigned to the id attribute of type primitive long. A record
 with Primary Key value = 0 already exists, so duplicate primary key check
 fails.

 This zip file contains a sample code with which I was able to reproduce
 this error.

 Adding a row with id=0 before persisting any object throws the error
 mentioned above.

 I request all to help in resolving this issue. The id 0 has been in use
 for many days using hibernate. Hence we would like not to change this row
 in the database.

 Also would like to know if there is any config parameter to change the
 default value of the id from 0 to any other value.



 Thanks and Regards,

 *KRISHNAPRASAD SUBBARAO*
 Software Developer, Cloud Platform (BSS), Industry Solutions, India
 Software Lab




--
Albert Lee.


Re: Fw: Error in EntityManager.persist () if the database already contains a row with id=0

2013-02-19 Thread Kevin Sutter
Are you indicating that if you remove the PART record with an id of 0 from
the database, then everything works just fine?  But, if you leave this
initial PART record with an id of 0, then you get the duplicate key
exception?  If that's the case and this PART with an id of 0 has to be part
of the dataset, then why not just start the id generation with a larger
number?  (That's what Albert's suggestion was, but he only replied to the
dev list.  BTW, if you post to multiple lists, then you need to monitor
multiple lists. It's just part of the game.  Thanks.)

Kevin

On Tue, Feb 19, 2013 at 2:50 AM, Krishnaprasad Subbarao 
krishnapras...@in.ibm.com wrote:

 Attaching a smaller size example to due attachment size issues.

 I am using OpenJPA 2.2.1. I request you to copy the openjpa-all-2.2.1.jar
 and the database driver in to the lib folder before executing the sample.


 Thanks and Regards,

 *KRISHNAPRASAD SUBBARAO*

 Software Developer, Cloud Platform (BSS), Industry Solutions, India
 Software Lab
  --
  [image: 2D barcode - encoded with contact information] 
 *Phone:*91-20-40117370|
 *Mobile:* 91--9096009911*
 E-mail:* *krishnapras...@in.ibm.com* krishnapras...@in.ibm.com*
 Chat:*[image: Google Talk:] krishnaprasad...@gmail.com *
 Find me on:* [image: LinkedIn:
 http://www.linkedin.com/in/krishnaprasadsubbarao]http://www.linkedin.com/in/krishnaprasadsubbarao
  *and within IBM on:* [image: IBM Connections:
 https://w3-connections.ibm.com/profiles/html/profileView.do?key=af2eda97-7154-43de-9565-cd3a3213fc31lang=en_us]https://w3-connections.ibm.com/profiles/html/profileView.do?key=af2eda97-7154-43de-9565-cd3a3213fc31lang=en_us

 [image: IBM]

 Tech Park One (panchshill)
 Pune, MH 411006
 India


 - Forwarded by Krishnaprasad Subbarao/India/IBM on 02/19/2013 02:12 PM
 -

 From:Krishnaprasad Subbarao/India/IBM
 To:users@openjpa.apache.org,
 Cc:users users@openjpa.apache.org
 Date:02/19/2013 01:54 PM
 Subject:Re: Error in EntityManager.persist () if the database
 already contains a row with id=0
 --


 Hello Rick/Kevin,

 Thanks for your suggestions.

 The mapping for *com.ibm.wdp.bss.party.entity.PartyObject* is defined in
 party.orm.xml. This contains a mapping   version name=*version*/for 
 version field used for optimistic locking.

 Also, I have manually corrected the party.orm.xml to add correct mapping
 for id field. The mapping for Id field defines a sequence generator with
 allocation-size=1 as defined below

   id name=*id*
 column name=*Id*/
 generated-value strategy=*SEQUENCE* generator=*PART_SEQ*/
 sequence-generator name=*PART_SEQ* sequence-name=*
 PART_SEQ* allocation-size=*1*/
   /id

 [attachment BSS-JPA.zip deleted by Krishnaprasad Subbarao/India/IBM] The
 attached sample contains a working sample to reproduce the error. The test
 database contains a row with id 0 in the table PART. The execution of
 JPAAddEntityTest.java fails with the error given in the first mail below.

 The moment I remove the row with id 0 manually from table PART and
 re-execute the JPAAddEntityTest.java. Records successfully get inserted in
 to PART table and ADDRESS table with appropriate next values from the
 sequences.

 I have following assumptions and questions about this issue.

1. Defining version in the .orm.xml file will not make any difference
as compared to the @version annotation specified in the Bean
2. Can we configure OpenJPA to use a different default value for
Identity fields say -1 instead of the Java default value 0. A new object to
be persisted in the database will have id attribute set to -1 instead of 0?
3. Can we configure OpenJPA to ignore the database row with Primary
Key 0?



 Thanks and Regards,

 *KRISHNAPRASAD SUBBARAO*

 Software Developer, Cloud Platform (BSS), Industry Solutions, India
 Software Lab
  --
  [image: 2D barcode - encoded with contact information] 
 *Phone:*91-20-40117370|
 *Mobile:* 91--9096009911*
 E-mail:* *krishnapras...@in.ibm.com* krishnapras...@in.ibm.com*
 Chat:*[image: Google Talk:] krishnaprasad...@gmail.com *
 Find me on:* [image: LinkedIn:
 http://www.linkedin.com/in/krishnaprasadsubbarao]http://www.linkedin.com/in/krishnaprasadsubbarao
  *and within IBM on:* [image: IBM Connections:
 https://w3-connections.ibm.com/profiles/html/profileView.do?key=af2eda97-7154-43de-9565-cd3a3213fc31lang=en_us]https://w3-connections.ibm.com/profiles/html/profileView.do?key=af2eda97-7154-43de-9565-cd3a3213fc31lang=en_us

 [image: IBM]

 Tech Park One (panchshill)
 Pune, MH 411006
 India





 From:Rick Curtis curti...@gmail.com
 To:users users@openjpa.apache.org,
 Date:02/19/2013 01:28 AM
 Subject:Re: Error in EntityManager.persist () if the database
 already contains a row with id=0
 --



 Could you try adding an 

Re: openjpa, maven and persistence.xml. help me please

2013-02-18 Thread Kevin Sutter
Welcome to the OpenJPA project!  Depending on your environment, getting the
Enhancement processing to find your persistence.xml can be tricky
sometimes.  I'm assuming you have looked at the available documentation for
getting this setup properly [1].  The key is probably in the error message
you received:

..Ensure that you have a
META-INF/persistence.xml file, that it is available in your classpath, or
that the properties file you are using for configuration is available.

The contents of your persistence.xml looks fine, so the issue is probably
with just finding your persistence.xml.  You have to ensure that this is
available via your classpath that is used for your enhancement processing.
With maven, it's sometimes useful to run with the -X option to see how your
properties, environment variables, and classpaths are getting setup.

Another idea that is simple is to use the javaagent approach for getting
the enhancement processing done.  This is especially useful for test
purposes, but can also be used for jse production usage.

Sorry that we don't have a definitive answer for you.  It looks like some
experimentation and understanding of your specific environment will be
required to get the enhancement done.  Good luck!  Please post back with
either success or continued issues.  Thanks.

This has nothing to do with your enhancement processing, but I would
suggest adding another property to your persistence.xml which will help
with foreign key processing:
property name=openjpa.jdbc.SynchronizeMappings
value=buildSchema(ForeignKeys=true)/

Kevin


[1]  http://openjpa.apache.org/entity-enhancement.html

On Mon, Feb 18, 2013 at 10:37 AM, laudio.info laudio.i...@gmail.com wrote:

 Hello
 i am trying to make my fisrt openjpa project.
 i am using maven.
 i have create the persistence.xml file (bellow) but when i try to compile
 my projects appears one error:
 [INFO] [openjpa:test-enhance {execution: enhancer}]
 [INFO]
 
 [ERROR] FATAL ERROR
 [INFO]
 
 [INFO] MetaDataFactory could not be configured
 (conf.newMetaDataFactoryInstance() returned null). This might mean that no
 configuration properties were found. Ensure that you have a
 META-INF/persistence.xml file, that it is available in your classpath, or
 that the properties file you are using for configuration is available. If
 you are using Ant, please see the properties or propertiesFile
 attributes of the task's nested config element. This can also occur if
 your OpenJPA distribution jars are corrupt, or if your security policy is
 overly strict.
 [INFO]
 
 [INFO] Trace
 openjpa-2.1.1-r422266:1148538 fatal user error
 org.apache.openjpa.util.MetaDataException: MetaDataFactory could not be
 configured (conf.newMetaDataFactoryInstance() returned null). This might
 mean that no configuration properties were found. Ensure that you have a
 META-INF/persistence.xml file, that it is available in your classpath, or
 that the properties file you are using for configuration is available. If
 you are using Ant, please see the properties or propertiesFile
 attributes of the task's nested config element. This can also occur if
 your OpenJPA distribution jars are corrupt, or if your security policy is
 overly strict.
  at

 org.apache.openjpa.meta.MetaDataRepository.initializeMetaDataFactory(MetaDataRepository.java:1904)
  at

 org.apache.openjpa.meta.MetaDataRepository.endConfiguration(MetaDataRepository.java:1885)
  at

 org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:518)
  at

 org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:443)

 My persistence.xml file is into the META-INF directory and has this:
 ?xml version=1.0 encoding=UTF-8?
 persistence xmlns=http://java.sun.com/xml/ns/persistence; version=2.0
   persistence-unit name=example transaction-type=RESOURCE_LOCAL

 providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider
 classcom.caf.db.jpa.entities.Myrequest/class
 classcom.caf.db.jpa.entities.Myresponse/class
 properties
  property name=openjpa.jdbc.SynchronizeMappings value=buildSchema
 /
   property name=openjpa.ConnectionDriverName
 value=org.apache.derby.jdbc.EmbeddedDriver /
   property name=openjpa.ConnectionURL
 value=jdbc:derby:C:\Curro\My\prototipoWorkspace\MyDB\MyDB /
   property name=openjpa.ConnectionUserName value= /
   property name=openjpa.ConnectionPassword value= /
 /properties
   /persistence-unit
 /persistence

 thanks



Re: openjpa.jdbc.SynchronizeMappings Values...

2013-02-14 Thread Kevin Sutter
Hi James,
I agree with your approach.  The synchronizeMappings property is great for
initial development, but once you have figured out the proper schema, you
don't want to be messing with it.  The easiest mechanism is to just remove
the property.

If you want to validate your schema against your entity mappings and throw
exceptions on mismatches, you could just use the validate option instead
of buildSchema.  All of the MappingTool options are available for the
SynchronizeMappings property [1].

property name=openjpa.jdbc.SynchronizeMappings value=validate/

Another option is to use the SchemaFactory property [2].  To do the
validation processing, I'd suggest using the native option:

property name=openjpa.jdbc.SchemaFactory value=native(ForeignKeys=true)/

Either of these approaches should do the trick for you.

Kevin

[1]
http://people.apache.org/~mikedd/nightly.builds/apache-openjpa-2.3.0-SNAPSHOT/docs/docbook/manual.html#ref_guide_mapping_mappingtool
[2]
http://people.apache.org/~mikedd/nightly.builds/apache-openjpa-2.3.0-SNAPSHOT/docs/docbook/manual.html#ref_guide_schema_info_factory

On Thu, Feb 14, 2013 at 2:29 PM, James Carman
jcar...@carmanconsulting.comwrote:

 Currently, during development, I use this value:

 buildSchema(ForeignKeys=true)

 However, when we go to production, we don't want to use that.  The way
 I've got it set up is using Spring and PropertyPlaceholderConfigurer (we
 put buildSchema(ForeignKeys=true) in a properties file).  Now, is there
 another value I can use for that setting that just validates the schema?
  Or, is there a value that will just do nothing?

 Thanks,

 James


Re: Mapping of Derived Identities does not work

2013-02-13 Thread Kevin Sutter
You must be using (on purpose or accidentally), the
openjpa.RuntimeUnenhancedClasses=supported property.  This subclassing
enhancement processing was only meant for simple demonstration purposes.
It's not meant for production usage.  If you use one of the recommended
approaches for byte-code enhancement of your entities [1], you'll have much
better luck.

Kevin

[1]  http://openjpa.apache.org/entity-enhancement.html

On Tue, Feb 12, 2013 at 9:39 PM, Riccardo 
riccardo.nim...@s2000.tu-chemnitz.de wrote:

 Hi all!

 I am trying to use a mapping of derived identities, as specified in the JSR
 317 section 2.4.1 but I get an error if I try to persist an entity. My
 entities look like this:

 @Entity
 public class User implements Serializable {
 @Id
 @Column(name = Id)
 private Long id;

 ...
 }

 @Entity
 public class Inventory implements Serializable {
 @Id
 @OneToOne
 @JoinColumn(name = Owner, referencedColumnName = Id)
 private User owner;

 ...
 }

 If I create a new inventory and try to persist it, I get the following
 error:

 - org.apache.openjpa.enhance.de$rini$persistence$User$pcsubclass cannot be
 cast to java.lang.Number

 I hope, somebody can tell me, what I am doing wrong.



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/Mapping-of-Derived-Identities-does-not-work-tp7582806.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Mapping of Derived Identities does not work

2013-02-13 Thread Kevin Sutter
Right, that's what my reference was for in my previous reply:  [1]
http://openjpa.apache.org/entity-enhancement.html

This should have all of the information you need, or pointers to
information you need, to accomplish your goal.

Kevin

On Wed, Feb 13, 2013 at 1:02 PM, Riccardo 
riccardo.nim...@s2000.tu-chemnitz.de wrote:

 Thanks for you reply Kevin. Indeed, I used the property you mentioned. I am
 new to OpenJPA and I use JBoss AS 7.1.1. Can you point me to some
 documentation, how I can enable the enhancing of entities on deployment or
 at runtime?

 So far I installed OpenJPA 2.1.1 as a module and my module.xml looks like
 this:

 module xmlns=urn:jboss:module:1.1 name=org.apache.openjpa
 resources
 resource-root path=openjpa-all-2.2.1.jar/
 resource-root path=serp-1.13.1.jar/
 /resources

 dependencies
 module name=javax.persistence.api/
 module name=javax.transaction.api/
 module name=javax.validation.api/

 module name=org.apache.log4j/
 /dependencies
 /module

 However, as soon as I try to access one of my entities I get the following
 error:

 - org.apache.openjpa.persistence.ArgumentException: This configuration
 disallows runtime optimization, but the following listed types were not
 enhanced at build time or at class load time with a javaagent



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/Mapping-of-Derived-Identities-does-not-work-tp7582806p7582820.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Request for help in fixing an issue in build time enhancement

2013-02-11 Thread Kevin Sutter
Hi,
Just to close on this discussion...  Krishnaprasad and I were discussing
this issue offline.  He eventually debugged the issue and tracked it down
to some errant orm.xml files.  Since an NPE is still not good regardless of
how he got to this situation, I have created a JIRA to track the issue:

https://issues.apache.org/jira/browse/OPENJPA-2331

Krishnaprasad, if you can append any additional details, they would be
appreciated.

Thanks,
Kevin

On Fri, Feb 8, 2013 at 2:57 PM, James Carman ja...@carmanconsulting.comwrote:

 Of course, but openjpa shouldn't need it.

 On Friday, February 8, 2013, Kevin Sutter wrote:

  If property access is desired, then appropriate getter/setter methods
 need
  to be defined for the Entity.
 
  On Thu, Feb 7, 2013 at 7:46 PM, James Carman ja...@carmanconsulting.com
 javascript:;
  wrote:
 
   Can't you map entities with no getters/setters?
  
   On Thursday, February 7, 2013, Kevin Sutter wrote:
  
Hi,
The NPE is happening in the code where OpenJPA is attempting to
  enhance a
getter method.  It looks like OpenJPA is assuming that the metadata
associated with a field (attribute) is available, but for some reason
  it
   is
not.  So, either the POJO doesn't contain all of the required
   getter/setter
methods.  Or, some field is being marked as being persistent, but
  doesn't
have the required getter/setter methods.
   
Granted, an NPE is not good.  But, we would need to understand the
   scenario
a bit more before resolving that issue.  My guess is that even if we
resolved the NPE, there is something else wrong with the environment,
   POJO,
or configuration that will prevent the enhancement from completing as
expected.
   
If you can re-create this issue with a simple junit, then that would
  help
with deciphering the real error and hopefully figure out proper
   resolution.
   
Just curious...  What version of Java are you using?  Java 7 threw in
   some
wrinkles that didn't get resolved until OpenJPA 2.2.x.  But, you
  claimed
this also didn't work with 2.2.x, so maybe Java 7 is not in the
  picture.
   
Thanks,
Kevin
   
On Thu, Feb 7, 2013 at 7:31 AM, Krishnaprasad Subbarao 
krishnapras...@in.ibm.com wrote:
   
 Hello,

 I am using OpenJPA 2.0.1 in a project and trying to enhance the
 POJO
 classes during build time. Following is the error I am getting from
 enhancer.

  [openjpac] openjpa-2.0.1-r422266:989424 nonfatal general error
 org.apache.openjpa.util.GeneralException: An error occurred while
 enhancing test.NewParty. Exception message: null
  [openjpac] at
 org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:549)
  [openjpac] at
 org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4654)
  [openjpac] at

  org.apache.openjpa.ant.PCEnhancerTask.executeOn(PCEnhancerTask.java:89)
  [openjpac] at

  org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:171)
  [openjpac] at

 org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
  [openjpac] at
  sun.reflect.GeneratedMethodAccessor3.invoke(Unknown
 Source)
  [openjpac] at


   
  
 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
  [openjpac] at java.lang.reflect.Method.invoke(Method.java:611)
  [openjpac] at

   
  
 
 org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
  [openjpac] at org.apache.tools.ant.Task.perform(Task.java:348)
  [openjpac] at
  org.apache.tools.ant.Target.execute(Target.java:357)
  [openjpac] at
 org.apache.tools.ant.Target.performTasks(Target.java:385)
  [openjpac] at

 org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
  [openjpac] at


   
  
 
 org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
  [openjpac] at
 org.apache.tools.ant.Project.executeTargets(Project.java:1189)
  [openjpac] at
org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
  [openjpac] at
 org.apach



Re: Problem with JPA Criteria

2013-02-11 Thread Kevin Sutter
For some reason, your original note never got to the mailing list...
Thanks for the pointer to the nabble reference.

It sounds like a valid issue.  Please open a JIRA.  Thanks.

Kevin

On Mon, Feb 11, 2013 at 9:14 AM, jakefrog hebol...@gmail.com wrote:

 Should I open open a bug report for this?



 --
 View this message in context:
 http://openjpa.208410.n2.nabble.com/Problem-with-JPA-Criteria-tp7582759p7582764.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Request for help in fixing an issue in build time enhancement

2013-02-08 Thread Kevin Sutter
If property access is desired, then appropriate getter/setter methods need
to be defined for the Entity.

On Thu, Feb 7, 2013 at 7:46 PM, James Carman ja...@carmanconsulting.comwrote:

 Can't you map entities with no getters/setters?

 On Thursday, February 7, 2013, Kevin Sutter wrote:

  Hi,
  The NPE is happening in the code where OpenJPA is attempting to enhance a
  getter method.  It looks like OpenJPA is assuming that the metadata
  associated with a field (attribute) is available, but for some reason it
 is
  not.  So, either the POJO doesn't contain all of the required
 getter/setter
  methods.  Or, some field is being marked as being persistent, but doesn't
  have the required getter/setter methods.
 
  Granted, an NPE is not good.  But, we would need to understand the
 scenario
  a bit more before resolving that issue.  My guess is that even if we
  resolved the NPE, there is something else wrong with the environment,
 POJO,
  or configuration that will prevent the enhancement from completing as
  expected.
 
  If you can re-create this issue with a simple junit, then that would help
  with deciphering the real error and hopefully figure out proper
 resolution.
 
  Just curious...  What version of Java are you using?  Java 7 threw in
 some
  wrinkles that didn't get resolved until OpenJPA 2.2.x.  But, you claimed
  this also didn't work with 2.2.x, so maybe Java 7 is not in the picture.
 
  Thanks,
  Kevin
 
  On Thu, Feb 7, 2013 at 7:31 AM, Krishnaprasad Subbarao 
  krishnapras...@in.ibm.com wrote:
 
   Hello,
  
   I am using OpenJPA 2.0.1 in a project and trying to enhance the POJO
   classes during build time. Following is the error I am getting from
   enhancer.
  
[openjpac] openjpa-2.0.1-r422266:989424 nonfatal general error
   org.apache.openjpa.util.GeneralException: An error occurred while
   enhancing test.NewParty. Exception message: null
[openjpac] at
   org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:549)
[openjpac] at
   org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4654)
[openjpac] at
   org.apache.openjpa.ant.PCEnhancerTask.executeOn(PCEnhancerTask.java:89)
[openjpac] at
   org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:171)
[openjpac] at
   org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[openjpac] at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown
   Source)
[openjpac] at
  
  
 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
[openjpac] at java.lang.reflect.Method.invoke(Method.java:611)
[openjpac] at
  
 
 org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[openjpac] at org.apache.tools.ant.Task.perform(Task.java:348)
[openjpac] at org.apache.tools.ant.Target.execute(Target.java:357)
[openjpac] at
   org.apache.tools.ant.Target.performTasks(Target.java:385)
[openjpac] at
   org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
[openjpac] at
  
  
 
 org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
[openjpac] at
   org.apache.tools.ant.Project.executeTargets(Project.java:1189)
[openjpac] at
  org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
[openjpac] at
   org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
[openjpac] at
   org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[openjpac] at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown
   Source)
[openjpac] at
  
  
 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
[openjpac] at java.lang.reflect.Method.invoke(Method.java:611)
[openjpac] at
  
 
 org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[openjpac] at org.apache.tools.ant.Task.perform(Task.java:348)
[openjpac] at org.apache.tools.ant.Target.execute(Target.java:357)
[openjpac] at
   org.apache.tools.ant.Target.performTasks(Target.java:385)
[openjpac] at
   org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
[openjpac] at
   org.apache.tools.ant.Project.executeTarget(Project.java:1306)
[openjpac] at
  
  
 
 org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[openjpac] at
   org.apache.tools.ant.Project.executeTargets(Project.java:1189)
[openjpac] at org.apache.tools.ant.Main.runBuild(Main.java:758)
[openjpac] at org.apache.tools.ant.Main.startAnt(Main.java:217)
[openjpac] at
   org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
[openjpac] at
   org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
[openjpac] Caused by: java.lang.NullPointerException
[openjpac] at
   or



Re: Request for help in fixing an issue in build time enhancement

2013-02-07 Thread Kevin Sutter
Hi,
The NPE is happening in the code where OpenJPA is attempting to enhance a
getter method.  It looks like OpenJPA is assuming that the metadata
associated with a field (attribute) is available, but for some reason it is
not.  So, either the POJO doesn't contain all of the required getter/setter
methods.  Or, some field is being marked as being persistent, but doesn't
have the required getter/setter methods.

Granted, an NPE is not good.  But, we would need to understand the scenario
a bit more before resolving that issue.  My guess is that even if we
resolved the NPE, there is something else wrong with the environment, POJO,
or configuration that will prevent the enhancement from completing as
expected.

If you can re-create this issue with a simple junit, then that would help
with deciphering the real error and hopefully figure out proper resolution.

Just curious...  What version of Java are you using?  Java 7 threw in some
wrinkles that didn't get resolved until OpenJPA 2.2.x.  But, you claimed
this also didn't work with 2.2.x, so maybe Java 7 is not in the picture.

Thanks,
Kevin

On Thu, Feb 7, 2013 at 7:31 AM, Krishnaprasad Subbarao 
krishnapras...@in.ibm.com wrote:

 Hello,

 I am using OpenJPA 2.0.1 in a project and trying to enhance the POJO
 classes during build time. Following is the error I am getting from
 enhancer.

  [openjpac] openjpa-2.0.1-r422266:989424 nonfatal general error
 org.apache.openjpa.util.GeneralException: An error occurred while
 enhancing test.NewParty. Exception message: null
  [openjpac] at
 org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:549)
  [openjpac] at
 org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4654)
  [openjpac] at
 org.apache.openjpa.ant.PCEnhancerTask.executeOn(PCEnhancerTask.java:89)
  [openjpac] at
 org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:171)
  [openjpac] at
 org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
  [openjpac] at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown
 Source)
  [openjpac] at

 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
  [openjpac] at java.lang.reflect.Method.invoke(Method.java:611)
  [openjpac] at
 org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
  [openjpac] at org.apache.tools.ant.Task.perform(Task.java:348)
  [openjpac] at org.apache.tools.ant.Target.execute(Target.java:357)
  [openjpac] at
 org.apache.tools.ant.Target.performTasks(Target.java:385)
  [openjpac] at
 org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
  [openjpac] at

 org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
  [openjpac] at
 org.apache.tools.ant.Project.executeTargets(Project.java:1189)
  [openjpac] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
  [openjpac] at
 org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
  [openjpac] at
 org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
  [openjpac] at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown
 Source)
  [openjpac] at

 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
  [openjpac] at java.lang.reflect.Method.invoke(Method.java:611)
  [openjpac] at
 org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
  [openjpac] at org.apache.tools.ant.Task.perform(Task.java:348)
  [openjpac] at org.apache.tools.ant.Target.execute(Target.java:357)
  [openjpac] at
 org.apache.tools.ant.Target.performTasks(Target.java:385)
  [openjpac] at
 org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
  [openjpac] at
 org.apache.tools.ant.Project.executeTarget(Project.java:1306)
  [openjpac] at

 org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
  [openjpac] at
 org.apache.tools.ant.Project.executeTargets(Project.java:1189)
  [openjpac] at org.apache.tools.ant.Main.runBuild(Main.java:758)
  [openjpac] at org.apache.tools.ant.Main.startAnt(Main.java:217)
  [openjpac] at
 org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
  [openjpac] at
 org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
  [openjpac] Caused by: java.lang.NullPointerException
  [openjpac] at
 org.apache.openjpa.enhance.PCEnhancer.createGetMethod(PCEnhancer.java:4420)
  [openjpac] at
 org.apache.openjpa.enhance.PCEnhancer.addGetMethod(PCEnhancer.java:3639)
  [openjpac] at
 org.apache.openjpa.enhance.PCEnhancer.addAccessors(PCEnhancer.java:3536)
  [openjpac] at
 org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:535)
  [openjpac] ... 32 more

 The build.xml defines the ant target for enhancement like this,

 target name=enhance depends=copy-resources.files
   !-- define the openjpac task; this can be done at 

Re: No foreign keys created by openJPA

2013-02-06 Thread Kevin Sutter
Hi guys,
I didn't see the properties being used in the persistence.xml file that you
posted...

But, in any case, these properties are mainly used for reading foreign key
information from the database.  During the table mapping processing, there
may be some verification of foreign key constraints as well.  This allows
OpenJPA to make more intelligent decisions when submitting SQL statements
in batch to avoid constraint collisions.

If you are looking for explicit foreign key specifications, then you'll
probably have to use the @ForeignKey annotation.

Hope this helps,
Kevin

On Tue, Feb 5, 2013 at 10:00 PM, Maxim Solodovnik solomax...@gmail.comwrote:

 Hello Kevin,

 I just test both properties (added to the persistence.xml) on MySQL 5.5
 (InnoDB)
 and foreign keys were created only for the fields annotated with
 @ForeignKey :(
 Is it expected behavior?

 openJPA version is 2.2.1

 foreign keys were checked with following SQL:
 SELECT * FROM information_schema.TABLE_CONSTRAINTS WHERE
 information_schema.TABLE_CONSTRAINTS.CONSTRAINT_TYPE = 'FOREIGN KEY';

 properties were added to the following xml:

 https://svn.apache.org/repos/asf/openmeetings/trunk/singlewebapp/src/META-INF/mysql_persistence.xml


 Thanks in advance for your help


 On Tue, Feb 5, 2013 at 9:58 PM, Kevin Sutter kwsut...@gmail.com wrote:

 Hi Sebastian,
 There are two ways to get the ForeignKeys automatically processed.

 property name=openjpa.jdbc.SynchronizeMappings
 value=buildSchema(ForeignKeys=true)/

 Since you were already using a variation of this property, maybe this is
 the easiest mechanism.  A very similar capability is provided by the
 Schema
 Factory [1]:

 property name=openjpa.jdbc.SchemaFactory
 value=native(ForeignKeys=true)/

 And, of course, there is the manual means of specifying the ForeignKeys
 via
 the @ForeignKey annotation.

 Hope this helps,
 Kevin

 [1]

 http://people.apache.org/~mikedd/nightly.builds/apache-openjpa-2.3.0-SNAPSHOT/docs/docbook/manual.html#ref_guide_schema_info_factory

 On Tue, Feb 5, 2013 at 1:07 AM, seba.wag...@gmail.com 
 seba.wag...@gmail.com
  wrote:

  We are using MySQL with InnoDB and OpenJPA 2.2.1
 
  We face an issue in the automatic table schema creation:
  Indices are created but no foreign keys.
 
  We are using this configuration file:
 
 
 http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/META-INF/mysql_persistence.xml?view=markup
 
  I guess this is all what configures our schema creation:
  property name=openjpa.jdbc.SynchronizeMappings value=buildSchema/
 
  What I would expect is for example for attributes/mapping like (example
 1
  simple ManyToOne association):
  @ManyToOne(fetch = FetchType.EAGER)
  @JoinColumn(name = roomtypes_id)
  private RoomType roomtype;
 
  That the attribute roomtypes_id will be created together with a FK and
 and
  Indice. However Only Indice is created no FK.
 
  The same for any attribute that has a ManyToOne or OneToMany or
 ManyToMany
  annotation.
 
  So the question is:
  Is there a config value for SynchronizeMappings that automatically
 creates
  not only the Indices but also the FK's for those relations?
  Or do we really need to annotate every attribute with @ForeignKey?
 
  Bonus question :)
  How would that work with a one-sided one-many association without a
 cross
  table?
 
  For example (example 2 one-sided one-many association)
  @OneToMany
  @ElementJoinColumn(name = whiteboarditem_id, referencedColumnName
 =
  id)
  private CollectionWhiteboardItem roomItems;
 
  If I add:
  @ForeignKey(enabled = true)
  to example 1 = ForeignKey is created by SchemaTool
  to example 2 = ForeignKey is _not_ created by SchemaTool
 
  How can I make SchemaTool to create FK in example 2?
 
 
  Thanks!
  Sebastian
  --
  Sebastian Wagner
  https://twitter.com/#!/dead_lock
  http://www.webbase-design.de
  http://www.wagner-sebastian.com
  seba.wag...@gmail.com
 




 --
 WBR
 Maxim aka solomax



  1   2   3   4   5   6   >