RE: Fetch plan question
how to dynamically, using fetch plan, exclude (rather than adding) to the fetch plan some attribute not to retrieve I probably misunderstand, but doesn't FetchPlan.clearFields() + FetchPlan.clearFetchGroups() followed by a few addField() do what you want (I haven't tried) ? http://openjpa.apache.org/builds/1.2.1/apache-openjpa-1.2.1/docs/javadoc /org/apache/openjpa/persistence/FetchPlan.html
RE: Fetch plan question
https://issues.apache.org/jira/browse/OPENJPA-1416
RE: openjpa-maven-plugin snapshot
Hello Mojoers, I support the request for an e.g. non-SNAPSHOT v1.1 OpenJPA Maven plugin published to a repo somewhere... Would be nice to be able to use the http://jira.codehaus.org/browse/MOPENJPA-8 fix! -Original Message- From: Adam Hardy [mailto:adam@cyberspaceroad.com] Sent: Wednesday, December 02, 2009 7:04 PM To: users@openjpa.apache.org Subject: Re: openjpa-maven-plugin snapshot Oh I thought the dev guys for the plugin preferred this user list. No problem. It looks like I'll have to download the source and have a go at it myself anyway. Regards Adam Michael Dick on 02/12/09 16:14, wrote: Hi all, The maven plugin is something different. The code is in codehaus SVN and the resulting binaries are probably published to a codehaus m2-snapshot repository. I don't know how often those get published, so I've cross-posted to their users email list. Sorry for the confusion, -mike On Tue, Dec 1, 2009 at 5:13 PM, Adam Hardy adam@cyberspaceroad.comwrote: ljnelson on 01/12/09 20:47, wrote: On Tue, Dec 1, 2009 at 1:48 PM, Michael Dick [via OpenJPA] ml-node+4095467-513228...@n2.nabble.comml-node%2b4095467-513228...@n2.n abble.com ml-node%2b4095467-513228...@n2.nabble.comml-node%252B4095467-513228112 @n2.nabble.com wrote: I publish the snapshots to the m2-snapshot repository on people.apache.orgfairly regularly. You can find 1.1.1-SNAPSHOT at http://people.apache.org/repo/m2-snapshot-repository/org/apache/openjpa/ openjpa/1.1.1-SNAPSHOT/ (Not part of this conversation, but is that for the OpenJPA Maven plugin, or just OpenJPA?) Looks like OpenJPA itself. I should have mentioned the openjpa-maven-plugin in the text as well as the title. Interesting to know about the repository for Apache snapshots though. Regards Adam This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: Using latest OpenJPA in WebLogic 10
Has anyone successfully used this with OpenJPA to avoid using the one provided by WebLogic? Uh, we are (in DEV), and AFAIK it works... Can you elaborate on I know that this doesn't work 100% of the time ?? -Original Message- From: KARR, DAVID (ATTCINW) [mailto:dk0...@att.com] Sent: Wednesday, December 02, 2009 7:30 AM To: users@openjpa.apache.org Subject: RE: Using latest OpenJPA in WebLogic 10 -Original Message- From: Ravi Palacherla [mailto:ravi.palache...@oracle.com] Sent: Tuesday, December 01, 2009 7:00 PM To: users@openjpa.apache.org Subject: RE: Using latest OpenJPA in WebLogic 10 Hi David, You can use Filtering Classloader that weblogic server supports. Yes, using the prefer-application-packages element in the weblogic-application.xml file. I'm familiar with that. The problem is, I know that this doesn't work 100% of the time. Has anyone successfully used this with OpenJPA to avoid using the one provided by WebLogic? -Original Message- From: KARR, DAVID (ATTCINW) [mailto:dk0...@att.com] Sent: Tuesday, December 01, 2009 6:41 PM To: users@openjpa.apache.org Subject: Using latest OpenJPA in WebLogic 10 I'm looking at using the latest GA release of OpenJPA, v1.2.1, on WebLogic 10 (not 10.3), in a webapp, not as an ejb-jar or EAR. Apparently WebLogic 10 already includes a version of OpenJPA, but certainly an older version. Will I have any trouble using the latest OpenJPA just in my webapp? Is there something I need to do to prevent conflicts? I'm familiar with prefer-web-inf-classes, but I'm not sure whether that will help. This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
Using latest OpenJPA in IBM WebSphere v7
Same question as in the previous/parallel thread RE: Using latest OpenJPA in WebLogic 10, but for IBM WebSphere (v7 only) : Do any of you here know how to officially get WAS to accept a more recent version (or simply a specific fixed version, instead of the one it comes with) of an OpenJPA JAR? Just placing one in the EAR seems to, obviously, not work. Just wondering. This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: Using latest OpenJPA in WebLogic 10
PS, another link which is how we learnt about and are using the prefer-application-packages stuff more specifically/directly documenting Using Different Oracle Kodo Versions than the previously posted generic classloading documentation is http://download.oracle.com/docs/cd/E15523_01/web./e13720/using_kodo. htm#BJFBBEHD, in 7 Using Oracle Kodo with WebLogic Server in Oracle(r) Fusion Middleware Programming Enterprise JavaBeans, Version 3.0 for Oracle WebLogic Server 11g Release 1 (10.3.1) (details given for future searches, as the link tends to 404). It would be nice if such instructions were available from IBM for WAS... -Original Message- From: Michael Vorburger Sent: Wednesday, December 02, 2009 12:13 PM To: 'users@openjpa.apache.org' Subject: RE: Using latest OpenJPA in WebLogic 10 Has anyone successfully used this with OpenJPA to avoid using the one provided by WebLogic? Uh, we are (in DEV), and AFAIK it works... Can you elaborate on I know that this doesn't work 100% of the time ?? -Original Message- From: KARR, DAVID (ATTCINW) [mailto:dk0...@att.com] Sent: Wednesday, December 02, 2009 7:30 AM To: users@openjpa.apache.org Subject: RE: Using latest OpenJPA in WebLogic 10 -Original Message- From: Ravi Palacherla [mailto:ravi.palache...@oracle.com] Sent: Tuesday, December 01, 2009 7:00 PM To: users@openjpa.apache.org Subject: RE: Using latest OpenJPA in WebLogic 10 Hi David, You can use Filtering Classloader that weblogic server supports. Yes, using the prefer-application-packages element in the weblogic-application.xml file. I'm familiar with that. The problem is, I know that this doesn't work 100% of the time. Has anyone successfully used this with OpenJPA to avoid using the one provided by WebLogic? -Original Message- From: KARR, DAVID (ATTCINW) [mailto:dk0...@att.com] Sent: Tuesday, December 01, 2009 6:41 PM To: users@openjpa.apache.org Subject: Using latest OpenJPA in WebLogic 10 I'm looking at using the latest GA release of OpenJPA, v1.2.1, on WebLogic 10 (not 10.3), in a webapp, not as an ejb-jar or EAR. Apparently WebLogic 10 already includes a version of OpenJPA, but certainly an older version. Will I have any trouble using the latest OpenJPA just in my webapp? Is there something I need to do to prevent conflicts? I'm familiar with prefer-web-inf-classes, but I'm not sure whether that will help. This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
Id/Object References always, with Null Objects
Hello, I was wondering what you guys would think about my Id/Object References always (either Full or Reference objects), with Null Objects approach (pattern?) that I just blogged about at http://www.vorburger.ch/blog1/2009/11/jpa-idobject-references-always-with.html Skip the blurb and just wget http://www.vorburger.ch/files/openJPA_CallbackIdea_Pattern.zip; unzip openJPA_CallbackIdea_Pattern.zip; cd openJPA_CallbackIdea_Pattern; mvn test to have a look at the well documented sample code illustrating the idea. Am interested in any comments/feedback/criticism you may have, via discussion on the list here, or directly via comments on the blog. Thanks in advance for your interest time! ___ Michael Vorburger http://www.vorburger.ch
RE: How to count on a query then reuse this query fetch data?
Hi 周雁鸣, CriteriaQueryUser cq = ... TypedQueryUser tq = em.createQuery(cq); tq.setFirstResult(0); tq.setMaxResults(10); ListUser users = tq.getResultList(); long count = users.size(); This will, normally, generate TWO SQL queries - a SELECT {columns} ... and a SELECT COUNT(id). Ok? -Original Message- From: 周雁鸣 [mailto:zhouyanm...@gmail.com] Sent: Monday, November 23, 2009 3:12 AM To: users@openjpa.apache.org Subject: How to count on a query then reuse this query fetch data? CriteriaQueryUser cq = ... TypedQueryUser tq = em.createQuery(cq); long count = count(tq); //howto? tq.setFirstResult(0); tq.setMaxResults(10); ListUser users = tq.getResultList(); how to implement count function and I can reuse query object to find entities. � This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. � Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. � Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. � An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. � If you have received this email in error, please notify the sender immediately and delete the original.
RE: NULL in @Id columns leads to disappearing objects
OK thanks a lot. I've just created https://issues.apache.org/jira/browse/OPENJPA-1397 for your tracking. -Original Message- From: Michael Dick [mailto:michael.d.d...@gmail.com] Sent: Tuesday, November 17, 2009 7:11 PM To: users@openjpa.apache.org Subject: Re: NULL in @Id columns leads to disappearing objects Hi Michael, On Tue, Nov 17, 2009 at 2:45 AM, Michael Vorburger mvorbur...@odyssey-group.com wrote: Can we interpret No Answer on this one from anybody as a Not Support / Not Interested / Go away? ;-) Interested, but in the middle of other things - will take a closer look when the day job permits me (sound fair)? If this cannot be supported (?), would it fair to suggest at least decent error handling for null values in @Id attributes? Agree. At first glance I think we can support this, but haven't looked at it enough to really understand the problem. Are any clarifications needed (c.f. initially attached unit test) ? The unit test was very helpful. In my initial read I thought you meant a completely null ID, testcase set me straight there. No easy answer for you though.. -mike This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: Generate .java Files from ora.xml?
Thomas, I think you would have to hack this yourself.. probably using any Template Engine (http://de.wikipedia.org/wiki/Template_Engine) such as e.g. http://freemarker.sourceforge.net/, or http://wiki.eclipse.org/Xpand. For example, we (at work) have built a fairly extensive generator of .java JPA Entity classes, from some older in-house model (not an ora.xml like you are looking for) using Xpand. As have many others of course, e.g. http://www.fornax-platform.org/ may interest you. Regards, Michael Vorburger Development Manager, Design Studio Odyssey Financial Technologies -Original Message- From: Thomas Polliard [mailto:tho...@polliard.com] Sent: Wednesday, November 18, 2009 1:42 AM To: users@openjpa.apache.org Subject: Generate .java Files from ora.xml? I have scoured the documentation and I see that the MappingTool works for creating schema and the Reverse takes a schema and generates .java files but if I create the ora.xml file and put my mappings in their then is there no way to generate the .java files from it. This would put the mapping into one place and would only require a codegen from ora.xml and schema-create from ora.xml. This would keep the mappings in one place and allow there to be no disconnect from mappings. Thanks Thomas Polliard -- View this message in context: http://n2.nabble.com/Generate-java-Files-from-ora-xml-tp4022362p4022362. html Sent from the OpenJPA Users mailing list archive at Nabble.com. This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: Deleting a persistant object not resulting exception but not deleting the data from database table
Balu, Your description isn't very clear, your making the object persistant using findById?! and your remove() results in an IllegalArgumentException: Removing a detached instance or does not result any exception ? If you ARE trying to do em.remove() on a detached entity, what may work (I have not tried it) is to use a getJpaTemplate().remove(getJpaTemplate().getReference(EmailerSchedulerEn tity.class, emailerScheduler.getId())) kind of approach. Regards. -Original Message- From: baluji [mailto:jaish...@gmail.com] Sent: Wednesday, November 18, 2009 8:35 AM To: users@openjpa.apache.org Subject: Deleting a persistant object not resulting exception but not deleting the data from database table hi, I am trying delete a detached instance resulting Caused by: java.lang.IllegalArgumentException: Removing a detached instance I am making the object persistant by using the method emailerScheduler= this.findById(emailScheduler.getId()); validating whether the object is persistant by using the following method that returns true. getJpaTemplate().contains(emailerScheduler); and then removing the object getJpaTemplate().remove(emailerScheduler); this does not result any exception.But it does not result deletion of the data from database. any help will be appreciated. Thanks Balu -- View this message in context: http://n2.nabble.com/Deleting-a-persistant-object-not-resulting-exceptio n-but-not-deleting-the-data-from-database-table-tp4023833p4023833.html Sent from the OpenJPA Users mailing list archive at Nabble.com. This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: How work around OpenJPA-1365
http://openjpa.apache.org/builds/1.2.1/apache-openjpa-1.2.1/docs/manual/ manual.html#ref_guide_fetch That sounds good, although it's not standard. But very, very, useful.. ;) I'm not sure how one can do serious ORM without (something like) this; the fetch = FetchType.LAZY / EAGER stuff is stuff way too static, IMHO. Always wondered why this never made it (http://www.dataservices-connection.com/2008/09/need-for-fetch-plans.htm l) from JDO v2 API (http://db.apache.org/jdo/api20/apidocs/javax/jdo/FetchPlan.html) into the JPA spec, not even in JPA v2 yet AFAIK.. is there any hope a JPA v2.x finally picks this up? -Original Message- From: Michael Simons [mailto:michael.sim...@optitool.de] Sent: Wednesday, November 18, 2009 11:54 AM To: users@openjpa.apache.org Subject: Re: How work around OpenJPA-1365 Hi Michael, Michael Dick schrieb: Hi Michael, Regarding seeing OPENJPA-1365 on 'vanilla' OpenJPA 1.2.1, I'll have to take a look at that. It probably happens if the query does not fetch records from the database. If that's what you're seeing then I just need to update the JIRA with that info. We are still investigating on this. Please stand by. I'm not terribly familiar with JDO. I was under the impression that OpenJPA's FetchPlans were identical (or nearly identical) to those in JDO. To use my example (Employee and Manager) you would do something like this : OpenJPAEntityManager em = getEntityManager(); OpenJPAQuery q = em.createQuery(SELECT m from Manager m ); q.getFetchPlan().addField(Manager.class, employees); ListManager managers = q.getResultList(); There's a lot more in the manual about it, I'd start looking at [1]. [1] Hope this helps, -mike On Tue, Nov 17, 2009 at 11:02 AM, Michael Simons michael.sim...@optitool.de wrote: Hi Mike, Do you mean fetchplan like described in the manual in chapter 1.7.4? Or is there a possibility to use JDO-FetchPlan with OpenJPA? If so, is there a description, how to do that? kind regards, Michael Michael Dick schrieb: Hi all, Daryl's correct, the duplicates returned by a JOIN FETCH clause are correct behavior. If you don't want the duplicates to be returned you should use the DISTINCT keyword and OpenJPA will remove duplicates from the list. There are several outstanding issues though (which I'm working on): 1.) OPENJPA-894: When results are returned from the database OpenJPA automatically removes duplicates from the list. If the results are fetched from memory the duplicates reappear. 2.) OPENJPA-1365: After you apply the fix for OPENJPA-894 the distinct keyword doesn't work. This is because OpenJPA merely prepends the DISTINCT keyword to the SQL generated which doesn't work if you're selecting across multiple tables. Instead we need to filter the result list after retrieving from the database. There are two proposed fixes for OPENJPA-894 each of which have some drawbacks. 3a.) Mike's fix : supports pagination but does not support multiple JOIN FETCH statements (ie SELECT m FROM Manager m JOIN FETCH m.employees JOIN FETCH m.projects returns the wrong number of results). 3b.) Fay's fix : supported multiple JOIN FETCH statements, but does not support pagination (ie query.setMaxResults(), query.setFirstResult() doesn't page forward as expected). So there is work being done, but it's turned out to be a very ticklish issue to solve. At the risk of muddying the waters a bit if you're migrating a JDO application have you considered using OpenJPA's FetchPlan implementation to eagerly load some fields? Over medium - large datasets I've found this to be significantly faster than using a JOIN FETCH, but YMMV. Hope this helps, -mike On Tue, Nov 17, 2009 at 8:48 AM, Daryl Stultz da...@6degrees.com wrote: On Tue, Nov 17, 2009 at 9:27 AM, Michael Simons michael.sim...@optitool.dewrote: You state, that you're query with distinct and join fetch does work properly. But this would mean OpenJPA-1365 doesn't occur, does it? The JIRA states: This issue occurs if the proposed fix for OPENJPA-894 is in place. So 1365 does not occur unless you've patched your code such that 894 is fixed. What version of OpenJPA are you using and do you have any patches in place? When we call select a from A a join fetch B we get n instances of A, with n = numbers of A-B-associations. This is the correct behavior. I have found with OpenJPA 1.2.1, I get distinct rows of A which sounds like what you (and I) want but is improper. 894 shows that a second run of the query in the same EntityManager yields duplicates A's (with LEFT JOIN FETCH). What happens when you do this: select distinct a from A a join fetch a.bs ? How about these two: select a from A a left join fetch a.bs select distinct a from A a left join fetch a.bs I don't want to give the impression that I'm an expert on the matter, just that I've
RE: NULL in @Id columns leads to disappearing objects
Can we interpret No Answer on this one from anybody as a Not Support / Not Interested / Go away? ;-) If this cannot be supported (?), would it fair to suggest at least decent error handling for null values in @Id attributes? Are any clarifications needed (c.f. initially attached unit test) ? Thanks. -Original Message- From: Michael Vorburger [mailto:mvorbur...@odyssey-group.com] Sent: Wednesday, November 11, 2009 6:57 PM To: users@openjpa.apache.org Subject: NULL in @Id columns leads to disappearing objects Hello again! We are working with an existing ('legacy') DB schema where columns which are part of a logical (there is no physical PRIMARY KEY CONSTRAINT) composed primary key (mapped in JPA via an @IdClass) CAN BE NULL. Neither the JPA Spec nor any OpenJPA documentation says that this is not permitted or requires that all @Id field never be null... ... but OpenJPA looses such objects when mapping in ResultSets - i.e. you get Query result Lists containing null elements! Attached is a small test case project, hopefully illustring this well (if the ZIP makes it through the list?). Any ideas how to work-around this on the (Open)JPA side (assume I can't do much about the 10 year old legacy schema installed 120 client sites :) ? Can you think of any other mapping approaches than a straightforward @IdClass as shown in the attached example? Otherwise... do you confirm / agree that this is a bug? Easy to fix?? ;) Regards lot's of thanks for feedbacks, Michael Vorburger * This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. * Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. * Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. * An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. * If you have received this email in error, please notify the sender immediately and delete the original. This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: Is it possible to turn off AutoDetach?
I tried to turn off auto detaching after commit or entity manager closing by setting openjpa.AutoDetach property to false or to empty value, but it seems not to work as I expected. Funny to see this email today.. I coincidentally tried this last week as well! I got it working on one open EM directly, with this (but read on): OpenJPAEntityManager oem = (OpenJPAEntityManager)em; System.out.println(oem.getAutoDetach()); EnumSetAutoDetachType d = oem.getAutoDetach(); d.clear(); oem.setAutoDetach(d); but NOT, whatever I tried, with any config. on the EntityManagerFactory... I know that this behavior is not exactly consistent with JPA standard. Exactly; so after a good night's sleep we're not using above, and found another solution to our problem instead. PS, if anybody is interested: The problem why we also initially wanted to turn off auto detaching for entity manager closing was that the http://static.springsource.org/spring/docs/2.0.8/api/org/springframework /orm/jpa/SharedEntityManagerCreator.html will fall back to a newly created EntityManager per operation for a non-transactional read, so it closes the EM in its Proxy, and thus stuff detaches before you get a chance to do anything in between. We are now going to do what we wanted to do before Spring does its close() and implicit detach in a @PostLoad instead. -Original Message- From: Adam Borkowski [mailto:borkos.de...@gmail.com] Sent: Monday, November 16, 2009 6:16 PM To: users@openjpa.apache.org Subject: Is it possible to turn off AutoDetach? I tried to turn off auto detaching after commit or entity manager closing by setting openjpa.AutoDetach property to false or to empty value, but it seems not to work as I expected. Is there any possibility to turn AutoDetach off? I'm using OpenJPA 1.2.1 version. I know that this behavior is not exactly consistent with JPA standard. Thanks, Adam Borkowski -- View this message in context: http://n2.nabble.com/Is-it-possible-to-turn-off-AutoDetach-tp4013250p401 3250.html Sent from the OpenJPA Users mailing list archive at Nabble.com. This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: Locking Exception after Persisting new entity
I think build time enhancement solved it. FYI: The run-time enhancement via subclassing has lot's of other problems (the agent seems fine though; it does essentially the same thing as the build time thing)... we specify openjpa.RuntimeUnenhancedClasses = unsupported (@see http://openjpa.apache.org/builds/1.2.1/apache-openjpa-1.2.1/docs/manual/ ref_guide_conf_openjpa.html#openjpa.RuntimeUnenhancedClasses) in our OpenJPA bootstrap stuff to prevent it in all situations (final runtime unit/integration tests). PS, also see https://issues.apache.org/jira/browse/OPENJPA-651. -Original Message- From: Cil-Gamir [mailto:hannes.visa...@rmb.co.za] Sent: Friday, November 13, 2009 8:56 AM To: users@openjpa.apache.org Subject: Re: Locking Exception after Persisting new entity Hi I think build time enhancement solved it. I'm getting a different error now org.apache.openjpa.persistence.EntityExistsException: An object of type za.co.rmb.rac.riskRatingEngineWeb.entities.Variable with oid 0 already exists in this context; another cannot be persisted. But at least the optimistic locking thing has taken a hike Unfortunately I have a teambuilding thing on today... so I can't fix this thing any further. Thanks a lot for the help Daryl Regards Hannes -- View this message in context: http://n2.nabble.com/Re-SOLVED-Re-Locking-Exception-after-Persisting-new -entity-tp3992651p3997874.html Sent from the OpenJPA Users mailing list archive at Nabble.com. This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: ArrayIndexOutOfBoundsException in org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.retrieve
https://issues.apache.org/jira/browse/OPENJPA-953, ok? - What happens next? ;-) -Original Message- From: Fay Wang [mailto:fyw...@yahoo.com] Sent: Wednesday, March 04, 2009 6:08 AM To: users@openjpa.apache.org Subject: RE: ArrayIndexOutOfBoundsException in org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.retrieve Hi Mike, This seems to be an openjpa bug. Please open a JIRA. Thanks! -Fay --- On Tue, 3/3/09, Fay Wang fyw...@yahoo.com wrote: From: Fay Wang fyw...@yahoo.com Subject: RE: ArrayIndexOutOfBoundsException in org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.retrieve To: users@openjpa.apache.org Date: Tuesday, March 3, 2009, 3:26 PM Yes, with your test case, I did see the problem. The difference between our test cases is that in your test case, you have pre-created/populated the tables, while I let openjpa to create and populate the tables for me. Let me take a look to see why this causes the ArrayIndexOutOfBoundsException. Regards, Fay --- On Tue, 3/3/09, Michael Vorburger mvorbur...@odyssey-group.com wrote: From: Michael Vorburger mvorbur...@odyssey-group.com Subject: RE: ArrayIndexOutOfBoundsException in org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.retrieve To: users@openjpa.apache.org Date: Tuesday, March 3, 2009, 2:51 PM Hello Fay, Uhm, I fiddled with the infrastructure of your ZIP a bit (NO code changed, but Mavenized, added a missing/forgotten persistence.xml, two CREATE TABLE and INSERT INTO), and voilà, run a mvn clean test on the attached updated test package and you'll see the problem! Do you confirm? Regards, Michael -Original Message- From: Fay Wang [mailto:fyw...@yahoo.com] Sent: Tuesday, March 03, 2009 10:21 PM To: users@openjpa.apache.org Subject: Re: ArrayIndexOutOfBoundsException in org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.retrieve Hmmm. I could not reproduce the error using your domain model in 1.2.0 and trunk. Attached is the test case. Could you run it to see it passes? Regards, Fay --- On Tue, 3/3/09, Michael Vorburger mvorbur...@odyssey-group.com wrote: From: Michael Vorburger mvorbur...@odyssey-group.com Subject: ArrayIndexOutOfBoundsException in org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.retrieve To: users@openjpa.apache.org Date: Tuesday, March 3, 2009, 11:57 AM Hello, I'm getting a ArrayIndexOutOfBoundsException in org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.retrieve (A pplicationIds.java:602), full stack trace below. This occurs when I try to use application ID Identity Hierarchies as per http://openjpa.apache.org/builds/1.2.0/apache-openjpa-1.2.0/docs/manua l/ jpa_overview_pc_identity.html#jpa_overview_pc_identity_hierarchy, may be because I was trying to use them together with Entities as Identity Fields as per http://openjpa.apache.org/builds/1.2.0/apache-openjpa-1.2.0/docs/manua l/ ref_guide_pc_oid.html#ref_guide_pc_oid_entitypk ... Both of this is not JPA 1.0 spec, is it? Will this later be possible via standard in JPA 2.0? Is there a better (in the sense of spec compliant) way to do this, or a workaround or even better bug fix for OpenJPA? Here is an attempt to sketch out the model that this occurs with: @javax.persistence.Entity(name = DictLabel) @IdClass(DictLabelId.class) @javax.persistence.Table(name = dict_label_vw) @javax.persistence.Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name=entity_dict_id, discriminatorType=DiscriminatorType.INTEGER) public abstract class DictLabelEntity { @Basic(optional = false) @javax.persistence.Column(name = name, nullable = false) private String name; @Id @javax.persistence.ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH}, fetch = FetchType.LAZY, optional = false) @javax.persistence.JoinColumn(name = language_dict_id, nullable = false) private DictLanguageEntity language; @Id @Basic(optional = false) @javax.persistence.Column(name = entity_dict_id, nullable = false) private long entityRef; } @Entity(name = DictLanguageLabel) @IdClass(DictLanguageLabelId.class) @DiscriminatorValue(value=1106) public class DictLanguageLabelEntity extends DictLabelEntity { @Id @javax.persistence.ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH}, fetch = FetchType.LAZY, optional = false) @javax.persistence.JoinColumn(name = object_dict_id, nullable = false) private DictLanguageEntity forLanguage; } public abstract class DictLabelId implements Serializable { public long language; public
ArrayIndexOutOfBoundsException in org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.retrieve
Hello, I'm getting a ArrayIndexOutOfBoundsException in org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.retrieve(A pplicationIds.java:602), full stack trace below. This occurs when I try to use application ID Identity Hierarchies as per http://openjpa.apache.org/builds/1.2.0/apache-openjpa-1.2.0/docs/manual/ jpa_overview_pc_identity.html#jpa_overview_pc_identity_hierarchy, may be because I was trying to use them together with Entities as Identity Fields as per http://openjpa.apache.org/builds/1.2.0/apache-openjpa-1.2.0/docs/manual/ ref_guide_pc_oid.html#ref_guide_pc_oid_entitypk ... Both of this is not JPA 1.0 spec, is it? Will this later be possible via standard in JPA 2.0? Is there a better (in the sense of spec compliant) way to do this, or a workaround or even better bug fix for OpenJPA? Here is an attempt to sketch out the model that this occurs with: @javax.persistence.Entity(name = DictLabel) @IdClass(DictLabelId.class) @javax.persistence.Table(name = dict_label_vw) @javax.persistence.Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name=entity_dict_id, discriminatorType=DiscriminatorType.INTEGER) public abstract class DictLabelEntity { @Basic(optional = false) @javax.persistence.Column(name = name, nullable = false) private String name; @Id @javax.persistence.ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH}, fetch = FetchType.LAZY, optional = false) @javax.persistence.JoinColumn(name = language_dict_id, nullable = false) private DictLanguageEntity language; @Id @Basic(optional = false) @javax.persistence.Column(name = entity_dict_id, nullable = false) private long entityRef; } @Entity(name = DictLanguageLabel) @IdClass(DictLanguageLabelId.class) @DiscriminatorValue(value=1106) public class DictLanguageLabelEntity extends DictLabelEntity { @Id @javax.persistence.ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH}, fetch = FetchType.LAZY, optional = false) @javax.persistence.JoinColumn(name = object_dict_id, nullable = false) private DictLanguageEntity forLanguage; } public abstract class DictLabelId implements Serializable { public long language; public long entityRef; // ... equals() ... hashCode() ... } public class DictLanguageLabelId extends DictLabelId { public long forLanguage; // ... equals() ... hashCode() ... } With this, a simple query for SELECT l FROM DictLanguageLabel l leads to the exception below. The DictLanguageEntity is another entity deliberately omitted, it's a standard one with a simple @Id private long id. If this model seems to make little sense, I have to admit that it is simplified, as in real life there are other subclasses of DictLabelEntity, where that object_dict_id is a ManyToOne to other entities than DictLanguageEntity. I actually found a work-around, as follows: No DictLanguageLabelId extends DictLabelId (and no @IdClass on DictLanguageLabelEntity), and make DictLabelId not abstract. Then add the following to the DictLabelEntity to double map that object_dict_id column (which is also mapped in the DictLanguageLabelEntity subclass), and remove the @Id from the forLanguage in DictLanguageLabelEntity: @Id @Basic(optional = false) @javax.persistence.Column(name = object_dict_id, nullable = false) private long objectRef; and add a public long objectRef; to the DictLabelId (with updated equals() and hashCode()). seems to work, but is clearly a work-around for what appears to be a bug... Regards, Michael ___ openjpa-1.2.0-r422266:683325 nonfatal user error org.apache.openjpa.persistence.ArgumentException: 2 at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:814) at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:775) at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:771) at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:5 17) at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:254) at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:29 3) at com.odcgroup.tangij.nls.LabelsDAO.getAllLabels(LabelsDAO.java:38) at com.odcgroup.tangij.nls.LabelsDAOTest.testLabels(LabelsDAOTest.java:34) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59) at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java: 98) at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79) at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(Met hodRoadie.java:87) at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77) at
RE: Mapping a temporary table
Hello, Is there any way (API; internal is fine..) to dynamically intercept a SQL query (AFTER it has been generated from JPQL) and modify it slightly (e.g. do a simple string replace on a table name by another one), just before it's sent down to the DB through the JDBC connection? I know about the JDBCListener, but that's a one way street - or is it not? There is probably something else? This would be a perfect solution for us for the use case described by Yann; and there is other use cases where this could be very handy. Thanks a ton, Michael -Original Message- From: Pinaki Poddar [mailto:ppod...@apache.org] Sent: mardi, 13. janvier 2009 05:21 To: users@openjpa.apache.org Subject: Re: Mapping a temporary table Consider Native Query that is dynamically constructed with temporary table name + appropriate ResultSetMapping that pours the projections of SQL query to your Entity class. -- View this message in context: http://n2.nabble.com/Mapping-a-temporary-table-tp2133474p2149510.html Sent from the OpenJPA Users mailing list archive at Nabble.com. This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
Missing (table)name on @PersistentCollection(elementEmbedded = true)
Hello, If you have a class A { @PersistentCollection(elementEmbedded = true) SetB someLongNameAttribute }, there will be a table A_B_someLongNameAttribute. We are looking for a way to change the name of such tables created by elementEmbedded (SQL table length problem), but unfortunately there is nothing like a @PersistentCollection(elementEmbedded = true, tableNameSuffix=short) to get a table name A_B_short - or is there, through another annotation? Only option is to actually rename the private attribute's name (keeping public getters and setters) ? Would this be a valid Enhancement request for future releases? Regards, Michael This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
Example of Enum mapping (fixed numbering)
Does anybody have a concrete example of how to map an enum with fixed ordinal numbering? I have a DB which has an numeric column where the existing values mean something. I want to map that to an Entity attribute of some enum type. Reading http://forums.oracle.com/forums/thread.jspa?threadID=658154 and http://appfuse.org/display/APF/Java+5+Enums+Persistence+with+Hibernate I realize standard JPA does NOT actually do this (shame! hopefully this will be considered in JPA 2.0). However using some kind of Custom Field Mapping / Value Handler / Field Strategy annotation (http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_gui de_mapping_custom) this probably possible... any example handy? Thanks, Michael This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: PK Problem, mismatched property
I'm not sure that's the problem, but have you tried not putting any @Column onto the QuestionResultsPK ? Otherwise, browsing the code around that ClassMetaData.validateAppIdClassPKs may help you understand better what the message is trying to tell you? -Original Message- From: ericp56 [mailto:[EMAIL PROTECTED] Sent: mardi, 9. septembre 2008 18:56 To: users@openjpa.apache.org Subject: PK Problem, mismatched property I have three tables: Question id long (PK) description string etc. Survey id long (PK) surveydate Date etc. QuestionResults SurveyResultsID (FK) QuestionID (FK) Answer Here's my class that won't persist, because of errors (to follow): @Entity @Table(name=QuestionResults) @IdClass(QuestionResultsPK.class) public class QuestionResults implements Serializable { private int answer; @Id @ManyToOne @JoinColumn(name=QuestionID) private QuestionProp questionid; @Id @ManyToOne @JoinColumn(name=SurveyResultsID) private SurveyResults surveyresultsid; ... Here's the PK class: @Embeddable public class QuestionResultsPK implements Serializable { @Column(name=SurveyResultsID, insertable=false, updatable=false) private SurveyResults surveyresultsid; @Column(name=QuestionID, insertable=false, updatable=false) private QuestionProp questionid; ... Here's the error raised: 12:33:02,703 ERROR [Survey] Exception in WriteQuestionResult 12:33:02,703 ERROR [Survey] openjpa-1.2.0-r422266:683325 fatal user error org.apache.openjpa.persistence.ArgumentException: The id class specified by type class com.abc.ivr.survey.QuestionResults 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: questionid at org.apache.openjpa.meta.ClassMetaData.validateAppIdClassPKs(ClassMetaDat a.java:1983) at org.apache.openjpa.meta.ClassMetaData.validateAppIdClass(ClassMetaData.j ava:1897) I ported this code from a Swing/Tomcat application, but I was using OpenJPA 1.1. Now I am using OpenJPA 1.2 on Geronimo (a 2.1.4 build) Any suggestions? Thanks, Eric -- View this message in context: http://n2.nabble.com/PK-Problem%2C-mismatched-property-tp1078084p1078084 .html Sent from the OpenJPA Users mailing list archive at Nabble.com. This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: current_date and persistent date field
Hello, Marc and Jeremy, others: I've been searching for a means to do something similar with JPQL but haven't found anything yet I'm wondering if the SQL passthrough extenion, see http://n2.nabble.com/Queries-using-specific-SQL,-e.g.-functions,-or-spec ific-operators---passthrough-SQL-pieces-without-full-native-query-td6688 56.html, could interest you? Can one do this with custom functions in OpenJPA ? May be one could write your own JDBCFilterListener for a need like this? It would be nice if this area was better documented... Regards, Michael -Original Message- From: Jeremy Bauer [mailto:[EMAIL PROTECTED] Sent: jeudi, 4. septembre 2008 21:14 To: users@openjpa.apache.org Subject: Re: current_date and persistent date field Marc, It isn't very elegant, but you could try using a native query with a cast to produce the result. I was able to get the native query below to produce only Orders for the current date using DB2. My 'created' field is defined as a TIMESTAMP, which is similar to the DATETIME datatype. @NamedNativeQuery(name=todaysOrders, query=select * from ORDER where CAST(created AS DATE) = current_date, resultClass=Order.class) This is, of course, DB specific so it may or may not work for with your DB (SQL Server?). I've been searching for a means to do something similar with JPQL but haven't found anything yet. -Jeremy This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: Fetch Group questions
LOW: fyi, JIRA about earlier discussion point 2 created: https://issues.apache.org/jira/browse/OPENJPA-701 -Original Message- From: Pinaki Poddar [mailto:[EMAIL PROTECTED] Sent: vendredi, 8. août 2008 19:41 To: users@openjpa.apache.org Subject: RE: Fetch Group questions hi, 2. so if a future OpenJPA version would offer a way to override this,per attribute not globally, we could leverage that; but it's certainly not critical. Do you want a JIRA for this? Yes. Why not? 4. Would a JIRA help? A JIRA has been created https://issues.apache.org/jira/browse/OPENJPA-671 -- View this message in context: http://n2.nabble.com/Fetch-Group-questions-tp534861p681237.html This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
Enable maxTableNameLength/maxColumnNameLength, and lower-case schema?
Hello, 1. How to get the mappingtool to actually check/enforce maxTableNameLength / maxColumnNameLength (fail if any table/colum would be longer) ? 2. How to get the mappingtool to generate all an lower-case schema (matters on a case-sensitive DB, such as Sybase). We've tried schemaCase = SCHEMA_CASE_LOWER but that doesn't do anything (at schema generation time at least). Then @Override getValidColumnName() as super.getValidColumnName(name, table).toLowerCase(), but that still leaves some auto-generated columns in upper-casee, as well as OPENJPA_SEQUENCE_TABLE table and columns. Thanks! This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: Queries using specific SQL, e.g. functions, or specific operators - passthrough SQL pieces without full native query
By chance I just stumbled upon the JDBCFilterListener interface, while looking for something totally different. It's implementations like GetColumn and more interestingly SQLEmbed, that price sql(\(SELECT AVG (PRICE) FROM PRODUCT_TABLE)\), look pretty interesting, and I think is for what I was asking for below? BUT these have @nojavadoc in the .java, there is nothing about this in the Doc, and I couldn't find anything by Googling... (unless I'm blind), so may be this is not the way to do this?? Would love some feedback on this from experts! -Original Message- From: Michael Vorburger [mailto:[EMAIL PROTECTED] Sent: lundi, 4. août 2008 18:47 To: users@openjpa.apache.org Subject: Queries using specific SQL, e.g. functions, or specific operators - passthrough SQL pieces without full native query Hello, We would like to create a JPA query where one piece of the WHERE is totally customized - a sort of pass through for a condition, imagine to e.g. call an SQL function from a DB that JPQL doesn't cover (something beyond e.g. CURRENT_DATE or the standard String functions; the exact use case is something to do with date comparison stuff, compare some datetime column without taking the year into account, something fun; but I'm trying to formulate it a bit more abstract.) I'm sure there is some way to do this? Full SQL native query passthrough is not really the answer here - as we do want JPQL (traversing relations) for other parts of the query, just on one field some SQL function should be executed. Thanks a lot, Michael _ Michael Vorburger, Odyssey Financial Technologies This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
Queries using specific SQL, e.g. functions, or specific operators - passthrough SQL pieces without full native query
Hello, We would like to create a JPA query where one piece of the WHERE is totally customized - a sort of pass through for a condition, imagine to e.g. call an SQL function from a DB that JPQL doesn't cover (something beyond e.g. CURRENT_DATE or the standard String functions; the exact use case is something to do with date comparison stuff, compare some datetime column without taking the year into account, something fun; but I'm trying to formulate it a bit more abstract.) I'm sure there is some way to do this? Full SQL native query passthrough is not really the answer here - as we do want JPQL (traversing relations) for other parts of the query, just on one field some SQL function should be executed. Thanks a lot, Michael _ Michael Vorburger, Odyssey Financial Technologies Direct phone: +41 21 310 00 86 (OAMS VOIP: 1086) Cell phone: +41 78 805 5541 Mailto: [EMAIL PROTECTED] This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: Clustering ID TableGenerator (OPENJPA_SEQUENCE_TABLE)
Sorry I meant clustering of JVM/AppServers, not databases. Can you or somebody else comment on that? - Maybe my question is actually stupid, and all works well as is... Each JVM node will get a separate block of IDs from e.g. OPENJPA_SEQUENCE_TABLE, and OpenJPA handles some form of locking/retry on that table to avoid hypothetical collision? All is well, out of the box? Hm... would love somebody to confirm (or deny) this... Thanks a lot. -Original Message- From: Pinaki Poddar [mailto:[EMAIL PROTECTED] Sent: jeudi, 10. juillet 2008 04:24 To: users@openjpa.apache.org Subject: Re: Clustering ID TableGenerator (OPENJPA_SEQUENCE_TABLE) Are you referring to clustering of databases or clustering of JVM/AppServers? If it is the former, openjpa-slice module that let a persistent unit be connected to multiple databases in the same transaction may be of some relevance. In slice, we designate one database in the cluster as 'master' for the purpose of ID generation. Michael Vorburger-4 wrote: Hello, How do you do Clustering and ID TableGenerator (e.g.OPENJPA_SEQUENCE_TABLE) ? Will this somehow magically work (how?), or will different nodes step on each other's feet because they'll use the same PK? Can they each use different slices ? If impossible, do you HAVE to use Identify columns or Sequence generators in the DB? I thought that was not such a good idea (if you have a choice), performance wise, because it requires an extra round-trip to the DB to get the PK e.g. to set it as FK. Also https://issues.apache.org/jira/browse/OPENJPA-464 states that Statement Batching won't work with GeneratedType=IDENTITY - so this option doesn't seem terribly tempting in order to get ID and clustering happily married together. How do people out there do this with OpenJPA? Thank you, Michael _ Michael Vorburger, Odyssey Financial Technologies This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original. -- View this message in context: http://n2.nabble.com/Clustering---ID-TableGenerator-%28OPENJPA_SEQUENCE_TABLE%29-tp471147p471566.html Sent from the OpenJPA Users mailing list archive at Nabble.com. This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: Tomcat Injection
Hello, You may want to have a look at Spring's JPA support, which I believe enables you to do what you want (inject an EntityManager), even if Tomcat is not an EJB container. I found this http://java.sys-con.com/read/366275.htm article useful. This http://dev2dev.bea.com/pub/a/2006/03/jpa-spring-medrec.html looks useful too (haven't read it). I'm sure http://static.springframework.org/spring/docs/2.5.x/reference/orm.html#o rm-jpa says it all. Regards, Michael -Original Message- From: ericp56 [mailto:[EMAIL PROTECTED] Sent: mercredi, 9. juillet 2008 14:51 To: users@openjpa.apache.org Subject: Re: Tomcat Injection Indeed, that is the answer. For now, I need to stick with Tomcat, so I'll create an EntityManagerFactory singleton. Thanks! Eric -- View this message in context: http://n2.nabble.com/Tomcat-Injection-tp395699p469860.html Sent from the OpenJPA Users mailing list archive at Nabble.com. This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
Stored Procedure support (AKA replace INSERT and UPDATE)
Hello, Does OpenJPA support Stored Procedures, like other ORMs (TopLink/EclipseLink, Hibernate)? Imagine a DB that exposes Views for SELECT-ing, and that requires you to call a stored proc for most INSERTs or UPDATEs. Is there any way to configure (?) something like When you persist the X Entity, don't do an INSERT ... INTO X, but CALL ... something ? Dito for UPDATE. I realize you can use (named) native queries that do Stored Procedures for queries, but that's not transparent in any way and I don't see how that could be used to replace INSERT/UPDATE after a persist(), unless I'm missing something. Reading e.g. https://issues.apache.org/jira/browse/OPENJPA-236 makes me think that it may be possible to code this somehow? Are any OpenJPA users doing this? Is this a good/bad idea? Is there anything coming / changing with the JPA 2.0 Spec in this space? Thank you, Michael _ Michael Vorburger, Odyssey Financial Technologies This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
Clustering ID TableGenerator (OPENJPA_SEQUENCE_TABLE)
Hello, How do you do Clustering and ID TableGenerator (e.g.OPENJPA_SEQUENCE_TABLE) ? Will this somehow magically work (how?), or will different nodes step on each other's feet because they'll use the same PK? Can they each use different slices ? If impossible, do you HAVE to use Identify columns or Sequence generators in the DB? I thought that was not such a good idea (if you have a choice), performance wise, because it requires an extra round-trip to the DB to get the PK e.g. to set it as FK. Also https://issues.apache.org/jira/browse/OPENJPA-464 states that Statement Batching won't work with GeneratedType=IDENTITY - so this option doesn't seem terribly tempting in order to get ID and clustering happily married together. How do people out there do this with OpenJPA? Thank you, Michael _ Michael Vorburger, Odyssey Financial Technologies This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: Disable dangerous fallback enhancement how?
This openjpa.RuntimeUnenhancedClasses=unsupported is GREAT! Saves A LOT of confusion. Thanks a ton, Kevin. IMHO the 'unsupported' is better/clearer than the 'warn'; I tried both. I noticed this isn't actually documented? ;) Created a bug report https://issues.apache.org/jira/browse/OPENJPA-650, just for the doc. Craig, all, so what to do to propose this for inclusion in the Standard? I've taken the liberty of entering an enhancement JIRA for this, see: https://issues.apache.org/jira/browse/OPENJPA-651 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: lundi, 23. juin 2008 21:33 To: users@openjpa.apache.org Subject: Re: Disable dangerous fallback enhancement how? Since the feature is incomplete, I think we should consider defaulting the property to unsupported. Granted, this makes it impossible to get up and running quickly, but we can guide the user with the error message explicitly saying something like To avoid havoc and trouble, please enhance your classes before running using the enhancer tool; enhance at runtime via the Java instrumentation; or run in a container. If you want to try running without enhanced classes, set the openjpa.RuntimeUnenhancedClasses property to pray. Craig On Jun 23, 2008, at 6:31 AM, Kevin Sutter wrote: Michael, This fallback enhancement can be turned off by using the openjpa.RuntimeUnenhancedClasses property set to unsupported. If your build processing fails to enhance your Entity classes, or your - javaagent isn't properly set up, or you are not running in a Container environment (essentially any of the normal enhancement processes), then having this property set will cause an error message and not fall into the fallback enhancement processing. Within the WebSphere environment, we actually set this openjpa.RuntimeUnenhancedClasses property to warn. This has the same net effect as unsupported -- that is, it does not allow you to fall into the fallback enhancement processing. But, it produces a couple of extra error messages that might help with debugging your situation. The unsupported option stops immediately. The warn option allows you to run a bit further, but you will eventually stop due to an unenhanced class detection. Thanks, Kevin On Mon, Jun 23, 2008 at 7:45 AM, Michael Vorburger [EMAIL PROTECTED] wrote: Hello, In my experience, that fallback enhancement mode (see http://openjpa.apache.org/docs/latest/manual/ref_guide_pc_enhance.htm l#ref_guide_pc_enhance_unenhanced_types) causes much more havoc and trouble and confusion than that it's of any use. (I'm not just ranting, but saying this based on experience with people starting to adopt an OpenJPA-based piece in-house here - more than once, problems like but it does way to many too much DB access! are because of this.) The fact that https://issues.apache.org/jira/browse/OPENJPA-293 is still an Open New Feature, with five open sub-tasks (so technically this development was never finished, yet it's automatically activated and shows up in the official doc) and in e.g. https://issues.apache.org/jira/browse/OPENJPA-444 (and may be others?) there are bug reports which are probably only due to this, may support my point of view? It would much rather that if Entities are not enhanced at build time (which we do, through Maven; but sometimes a developers has Eclipse overwriting) and the Agent (which developers are encouraged to do when developing locally e.g. in JUnit Test for rapid cycles) is not in use, that instead of going to that fallback enhancement mode, it would abort and say Use the build-time Enhancer or specify the Agent to Enhance at Run-Time (or deploy into a EJB container which does enhancement). How about some sort of OpenJPA configuration property for this? For backward compatibility, now that it's out, it probably has be remain ON by default (or can you make it OFF by default?), but at least give us a configuration option to switch this *#ç mode ;-) off! Shall I file a new JIRA Enhancement requesting this? Thanks, Michael PS: In the short term, I may make our own OpenJPA wrapper/helper stuff to abort... it should be relatively easy to check at start-up if some class implements org.apache.openjpa.enhance.PersistenceCapable (by the Enhancer), but how could I check if, alternatively, the Agent is actively running? _ Michael Vorburger, Odyssey Financial Technologies Direct phone: +41 21 310 00 86 (OAMS VOIP: 1086) Cell phone: +41 78 805 5541 Mailto: [EMAIL PROTECTED] * This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. * Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. * Any views
Disable dangerous fallback enhancement how?
Hello, In my experience, that fallback enhancement mode (see http://openjpa.apache.org/docs/latest/manual/ref_guide_pc_enhance.html#ref_guide_pc_enhance_unenhanced_types) causes much more havoc and trouble and confusion than that it's of any use. (I'm not just ranting, but saying this based on experience with people starting to adopt an OpenJPA-based piece in-house here - more than once, problems like but it does way to many too much DB access! are because of this.) The fact that https://issues.apache.org/jira/browse/OPENJPA-293 is still an Open New Feature, with five open sub-tasks (so technically this development was never finished, yet it's automatically activated and shows up in the official doc) and in e.g. https://issues.apache.org/jira/browse/OPENJPA-444 (and may be others?) there are bug reports which are probably only due to this, may support my point of view? It would much rather that if Entities are not enhanced at build time (which we do, through Maven; but sometimes a developers has Eclipse overwriting) and the Agent (which developers are encouraged to do when developing locally e.g. in JUnit Test for rapid cycles) is not in use, that instead of going to that fallback enhancement mode, it would abort and say Use the build-time Enhancer or specify the Agent to Enhance at Run-Time (or deploy into a EJB container which does enhancement). How about some sort of OpenJPA configuration property for this? For backward compatibility, now that it's out, it probably has be remain ON by default (or can you make it OFF by default?), but at least give us a configuration option to switch this *#ç mode ;-) off! Shall I file a new JIRA Enhancement requesting this? Thanks, Michael PS: In the short term, I may make our own OpenJPA wrapper/helper stuff to abort... it should be relatively easy to check at start-up if some class implements org.apache.openjpa.enhance.PersistenceCapable (by the Enhancer), but how could I check if, alternatively, the Agent is actively running? _ Michael Vorburger, Odyssey Financial Technologies Direct phone: +41 21 310 00 86 (OAMS VOIP: 1086) Cell phone: +41 78 805 5541 Mailto: [EMAIL PROTECTED] This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: Persist pojo
How about you check the DB2 documentation about what SQLCODE: -530, SQLSTATE: 23503 means? Sometimes it helps to try on another DB, e.g. an embedded Derby, for clarity. -Original Message- From: Scherer, Annette [mailto:[EMAIL PROTECTED] Sent: jeudi, 8. mai 2008 15:53 To: users@openjpa.apache.org Subject: Persist pojo Hi, I want to persist a pojo to Database per JPA. It fails with following message openjpa-1.0.2-r420667:627158 nonfatal general error org.apache.openjpa.persistence.PersistenceException: DB2 SQL error: SQLCODE: -530, SQLSTATE: 23503 Thank you for valuable Information Here is the relevant coding: Annotated Classes: public class DomainAssociation implements Serializable { @Column(name=DA_NAME, length=50) @Id private String name; @Column(name=DA_BEMERKUNG, length=200) private String comment; @OneToMany(mappedBy=domainAssociation, cascade=CascadeType.ALL , fetch=FetchType.EAGER) private ListDomain domains; public class Domain implements Serializable { @Column(name=DOMAIN_NAME, length=50) @Id private String name; @Column(name=DOMAIN_VERWENDUNG, length=5) private String use; @Column(name=DOMAIN_TYP, length=10) private String type; @Column(name=DOMAIN_BEMERKUNG, length=200) private String comment; @ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.PERSIST) @JoinColumn(name=DA_NAME) private DomainAssociation domainAssociation; @OneToMany(mappedBy=domain, cascade=CascadeType.ALL , fetch=FetchType.EAGER) private ListDomainValue domainValues; Persistence.xml 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_1_0.xsd; version=1.0 persistence-unit name=InitializeSourceDomaenenDB provider org.apache.openjpa.persistence.PersistenceProviderImpl /provider jta-data-sourcejava:comp/env/jdbc/domaenendb/jta-data-source properties property name=openjpa.TransactionMode value=managed/ property name=openjpa.ConnectionFactoryMode value=managed/ property name=openjpa.jdbc.DBDictionary value=db2/ property name=openjpa.jdbc.Schema value=XX/ /properties /persistence-unit /persistence Executed code DomainAssociation da = new DomainAssociation(); da.setName(da); da.setComment(comment); Domain dom1 = new Domain(); dom1.setName(domain1); dom1.setUse(PRES); dom1.setType(String); dom1.setComment(comment); dom1.setDomainAssociation(da); Domain dom2 = new Domain(); dom2.setName(domain2); dom2.setUse(MOD); dom2.setType(String); dom2.setComment(comment); dom2.setDomainAssociation(da); ListDomain domains = new VectorDomain(); domains.add(dom1); domains.add(dom2); da.setDomains(domains); this.getEm().persist(da); Thrown Exception: openjpa-1.0.2-r420667:627158 nonfatal general error org.apache.openjpa.persistence.PersistenceException: DB2 SQL error: SQLCODE: -530, SQLSTATE: 23503, SQLERRMC: T7.TADOMAIN.FK_01 {prepstmnt 1699374410 INSERT INTO T7.TADOMAIN (DOMAIN_NAME, DOMAIN_BEMERKUNG, DOMAIN_TYP, DOMAIN_VERWENDUNG, DA_NAME) VALUES (?, ?, ?, ?, ?) [params=(String) domain2, (String) comment, (String) String, (String) MOD, (String) da]} [code=-530, state=23503]SQLCA OUTPUT[Errp=SQLRI079, Errd=-2145779603, 0, 0, 0, -100, 0] Dear greetings Annette Scherer This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: Question about @OneToMany
Hello, Similar situation here, and I wonder about people's thoughts pros/cons regarding this: Your solution (anotate ModelObject parent; with @ManyToOne instead of @Transient and add mappedBy=parent to @OneToMany) works, also for my application, but turns the uni-directional relation into a bi-directional relation. And this bi-directional relation is more dificult to manage and not needed in our Java application. Why is this bi-directional relation is more dificult to manage and not needed in our Java application ? If you let OpenJPA deal with this for you with the Managed Inverses (http://openjpa.apache.org/docs/latest/manual/ref_guide_inverses.html), what's the problem with an additional field? Hide it even - if for some reason you don't want to expose the bi-directionality to the users of the object model for keep that '@ManyToOne ModelObject parent' as a private with no setters and getters - just to get the desired mapping! What's the issue with this approach? (Portability and not wanting to use Managed Inverses aside; but I don't know if that's strong enough, you're using OpenJPA specific configuration elsewhere already, and that's really what this is - a runtime configuration specific to one JPA implementation. Other implementations may have a similar feature? If not, worst case, when switching, manually code the logic [with loop detection, if needed]). Regards, Michael -Original Message- From: Uden [mailto:[EMAIL PROTECTED] Sent: jeudi, 8. mai 2008 21:37 To: users@openjpa.apache.org Subject: Re: Question about @OneToMany Hi Andy, thanks for the quick response. In my application i had three tables generated (a master, a detail and a join table) for what i believed could be modelled by just the master and a detail table (at least in traditional database modeling). So when i was looking for a solution to simplify my datamodel in the database, i found this posting which looked similar to my problem and added my question. I need to map the following Java classes (note i reuse Marco's code example): @MappedSuperclass @Inheritance(strategy=InheritanceType.TABLE_PER_CLASS) class ModelObject { @Id private int id @Transient ModelObject parent; @OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.EAGER) ListModelObject children; . } @Entity class Company extends ModelObject { } @Entity class Employer extends ModelObject { } to the folowing database tables: COMPANY (ID (PK) , ... ) and EMPLOYEE (ID (PK) ,COMPANY_ID(FK to COMPANY.ID) , ... ) In Marco's original question he indicates that in his case openjpa create 4 tables (Company, Company_children, Emplpyer and Employer_children).. Your solution (anotate ModelObject parent; with @ManyToOne instead of @Transient and add mappedBy=parent to @OneToMany) works, also for my application, but turns the uni-directional relation into a bi-directional relation. And this bi-directional relation is more dificult to manage and not needed in our Java application. It does however results in a simpler datamodel. Your second solution changes the direction (or ownership) of the relation in the Java model. So it seems we have to trade a simplified database datamodel versus a simplified Java datamodel. Or is there an other solution? thanks, Uden hazen wrote: Hi Uden, If you'd rather keep the relation unidirectional just remove the `children` field-- the `parent` field alone is enough to encode the relation without recourse to a separate join table. Either way, I don't see how the quoted section below results in a join table. Both fields rely solely on a parent_id column within the ModelObject table, not on some other join table. Am I missing something? Andy Uden wrote: The solution quoted below but has a consequence for the Java class model: the OneToMany relationship becomes bi-directional instead of uni-directional. What is the reason for creating the join-table? I thought (based on my database experience) that a join-table is only required for ManyToMany relationships. If you look at the data in the join-table of a uni-directional relation (no mappedBy attribute), the relation between the join-table and master table is always OneToOne, so this relation could be handled by a FK-field in the detail-table. thanks for your explanation, Uden Andy Schlaikjer-2 wrote: Marco Schwarz wrote: How can I make only 2 tables? Here's my guess: First, use the mappedBy property of the @OneToMany annotation, like this: @Entity class ModelObject { ... @ManyToOne ModelObject parent; @OneToMany(mappedBy=parent) ListModelObject children; ... } This way, an extra join table won't be necessary to encode the parent child relationship. Only the parent_id column in the ModelObject table will be used to encode the relationship. -- View this message in context:
RE: maintaining bi-directional relationships
Why not use OpenJPA Managed Inverses, http://openjpa.apache.org/docs/latest/manual/ref_guide_inverses.html ? -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: mercredi, 7. mai 2008 17:51 To: users@openjpa.apache.org Subject: maintaining bi-directional relationships This is a design question really, sorry it's a little OT. I assume I have responsibility for maintaining parent - child relationships reflected by the parent.getChildren collection and child.getParent entity at the point where the change occurs. Is there a good pattern to implement changes to both the children collection on the parent and the parent entity on the child? One approach: setting field-access on the entity mapping, and adding code to the setters with some sort of mechanism to stop infinite looping. Thanks in advance Adam This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: One-Sided One-Many Mapping, but to different tables - missing @ElementEmbeddedMapping ?
Hello, my last phrase are there any plans was actually a question, no response... really no comment? This is unfortunately turning into a show stopper for our use of OpenJPA, and we probably have to have a look at another ORM ;-( which seems to support this kind of mapping... whine whine, hope hope for a magic answer that this is just coming... ;-) PS: I looked through the JIRA and couldn't see anything related to this, so I took the liberty to file https://issues.apache.org/jira/browse/OPENJPA-593, hope that's OK. -Original Message- From: Michael Vorburger Sent: mercredi, 30. avril 2008 00:48 To: users@openjpa.apache.org; [EMAIL PROTECTED] Subject: RE: One-Sided One-Many Mapping, but to different tables - missing @ElementEmbeddedMapping ? PS: I just saw that http://jcp.org/en/jsr/detail?id=317 (Java Persistence 2.0) says ... support for collections of embedded objects, multiple levels of embedded objects ... ... hm. Can anybody comment if there are plans for this? -Original Message- From: Michael Vorburger [mailto:[EMAIL PROTECTED] Sent: Tue 4/29/2008 7:48 PM To: users@openjpa.apache.org Subject: RE: One-Sided One-Many Mapping, but to different tables - missing @ElementEmbeddedMapping ? Hello again, Actually, this doesn't work as expected for us after all... limitation: openjpa-1.1.0-SNAPSHOT-r422266:641891M fatal user error org.apache.openjpa.util.MetaDataException: X.yelement:class Y is mapped as embedded, but embedded field ... is not embeddable. Embedded element/key/value types are limited to simple fields and direct relations to other persistent types. The message is clear in what it means, but this actually limits the usefulness of this somewhat. (A colleague tells me in Hibernate this kind of mapping is possible.) I don't suppose there are any plans to address this limitation (or later version already have; I'm on a 1.1.0-SNAPSHOT.jar built from trunk as of 29.03.2008). Regards, Michael -Original Message- From: Michael Vorburger [mailto:[EMAIL PROTECTED] Sent: samedi, 29. mars 2008 03:14 To: users@openjpa.apache.org Subject: RE: One-Sided One-Many Mapping, but to different tables - missing @ElementEmbeddedMapping ? Patrick - I pulled an OpenJPA 1.1.0-SNAPSHOT from SVN and built it locally to give it a whirl - and indeed this appears to work like a charm! Great. Can anybody provide insight on about what timeframe your hoping to push v1.1 to a release? Roughly. PS: I'm using the following annotations: @PersistentCollection(elementEmbedded=true) @ContainerTable(name=RelA___RelB, [EMAIL PROTECTED](name=A_ID)) private SetRelB bs = new HashSetRelB(); Thanks! -Original Message- From: Patrick Linskey [mailto:[EMAIL PROTECTED] Sent: jeudi, 20. mars 2008 17:55 To: users@openjpa.apache.org Subject: Re: One-Sided One-Many Mapping, but to different tables - missing @ElementEmbeddedMapping ? Hi, You're describing the use case for the @Embeddable annotation in JPA. You're also describing a feature that's there in OpenJPA 1.1.0-SNAPSHOT but not in OpenJPA 1.0 -- embedded values in collections. Upgrade and things should work. FWIW, this behavior will be part of JPA2. -Patrick On Mon, Mar 17, 2008 at 11:07 AM, Michael Vorburger [EMAIL PROTECTED] wrote: Hi, I need to map the Elements contained in a OneToMany Collection (Set) in some class to one table, and Elements of the same Class Type contained in a OneToMany Collection (Set) in another class to another table. Know what I mean? The example on the Subscription/LineItem example from http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manua l/ manual.html#ref_guide_mapping_jpa_onemany works (of course), but imagine another class that holds the same kind of LineItem classes.. another @OneToMany @ElementJoinColumn will lead to another inverse foreign key mapping, and the one and only SUB table will have two; not what I want. Now before somebody says RTFM ;) - I read about the @PersistentCollection(elementEmbedded=true) @ContainerTable (in the OpenJPA doc just above the link above, but the example on http://edocs.bea.com/kodo/docs41/full/html/ref_guide_mapping_ejb.html# re f_guide_mapping_ejb_coll_ex helped) and it indeed does the mapping as I'm expecting it... but also adds a weired unneccassyary additional column of type 'image' (on Sybase, a BLOB on Derby) named after the Collection field (e.g. items) - on the LINE_ITEM instead of on the SUB table! How do I get rid of that column? I noticed Kodo has an @ElementEmbeddedMapping that's not in OpenJPA, but from what I understand that's only to override stuff? That @PersistentCollection(elementEmbedded=true) already says the Elements should be embedded. So why that additional binary column? Or this kind of mapping impossible with OpenJPA (it's clearly possible - there is just an additional annoying column...) Is there a way to do the same differently? BTW: I'm assuming
RE: update always called on commits (still)
I'm sure it's not that simple, but you aren't maybe by chance not using enhancement (build or that -javaagent) and relying on the OpenJPA feature that allows to run even unenhanced in some kind of degraded mode (there is a log at the beginning if you're in that mode), and we noticed that change tracking seems very unreliable in that mode, and you easily get unncessarry SQL UPDATE statements. Note also the https://issues.apache.org/jira/browse/OPENJPA-507. If you're sure you're enhancing (correctly; not e.g. having Eclipse overwrite your .class), this is surely something else; sorry. -Original Message- From: Tedman Leung [mailto:[EMAIL PROTECTED] Sent: mercredi, 7. mai 2008 19:12 To: users@openjpa.apache.org Subject: update always called on commits (still) Hi while back we had a discussion on updates (or more specifically preupdates) always being called even when no changes where made. I noticed there was an issue OPENJPA-506 openned for this and currently closed - but this still occurs. Both anotated @PreUpdate methods as well as updates are always called even on read only operations. Does anyone know if this is considered an open issue or a fixed issue? I'm running OpenJPA 1.1 checkout from SVN on April 28th, 2008 which is long after the fixed date of Feb 1 2008. This is now causing me even worst problems due to a recent change in my application where I switched from using @PreUpdate to @Version to keep track of the last updated time of an object. Previously the lastUpdated field was useless because it was just the last time some one read the object, now it's throwing OptimisticLockException because requests are thinking some one else updated the object (when in reality it was just readonly). -- Ted Leung [EMAIL PROTECTED] You know you're in trouble when snow starts to clog your ram jets. This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: Synchronizing two databases with the same model
Jonas, I wonder if the OpenJPA Remote and Offline Operation stuff (http://openjpa.apache.org/docs/latest/manual/ref_guide_event.html) may allow you to build what you're after... Regards, Michael -Original Message- From: Andy Schlaikjer [mailto:[EMAIL PROTECTED] Sent: jeudi, 1. mai 2008 18:44 To: users@openjpa.apache.org Subject: Re: Synchronizing two databases with the same model Jonas, I'm glad you asked this question as I'd also been thinking about how I might get around restrictions the @GeneratedValue annotation enforces within OpenJPA. In certain circumstances I need to specify the value of a field marked with @GeneratedValue explicitly when persisting a new entity instance. I'd hoped that perhaps merge semantics would differ from persist semantics with respect to this constraint, but it seems (quite logically) that the constraint is applied uniformly to all entity life-cycle operations. For the time being I've had to fall back on JDBC to persist new data, but it'd be great if there were a way to signal to OpenJPA that a field marked with GeneratedValue may be explicitly defined for certain operations, like merge or persist. Andy Jonas Petersen wrote: Hi Brill, thanks for replying. The thing is, that only certain parts (e.g. an entity with certain id including child objects) have to get synchronized at the time by demand of a content editor. The datastore is mysql 5. Jonas Brill Pappin schrieb: Actually, the most obvious approach is not to write some special code, but simply enable replication and don't worry about trying to get OJPA to sync. What kind of database is it (most popular db's have replication of one sort or another)? - Brill Pappin -Original Message- From: Jonas Petersen [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 3:25 PM To: users@openjpa.apache.org Subject: Synchronizing two databases with the same model Hi there! We have one data model and we need two datastores with that same data model. Datastore A for editing and previewing and datastore B for production (live). Now we need to synchronize parts of datastore A to datastore B. The most obvious approach would be: fetch objects from datastore A (and possibly detach the objects) and then merge them in database B. But this rises a couple of problems due to versioning / sequence generators / optimistic locking / ... e.g.: - If objects (detached from datastore A) do not exist in datastore B, they are assumed deleted and an exception is thrown - Since we're using the GeneratedValue annotation for ids, objects would not be able to get persisted in datastore B even if they were new. Do you have any idea how to solve this problem in a regular way? One (non JPA-)way would be to implement it with native queries. Maybe this is the only way? Would probably be harder to maintain though. Thanks for any suggestion! Regards Jonas This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
Jazoon conference, anybody?
Hello, Is anybody here may be attending the http://jazoon.com/ conference (in Zurich/Switzerland, in late June) ? I'll be there and it could be fun to meet-up with other OpenJPA folks from near or far. Regards, Michael _ Michael Vorburger, Odyssey Financial Technologies This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: List mapping of Enumerated Types
Amit, I imagine I do not need a join table, but a child table that has the owner entity ID, Enumerated String Value and a Sequence, but I do not know how to represent that in a @OneToMany annotation. This looks a bit like my Re: One-Sided One-Many Mapping, but to different tables - missing @ElementEmbeddedMapping ? thread (monologue, almost). With the latest trunk and upcoming 1.1 version of OpenJPA you can use @ContainerTable instead of @OneToMany it seems for this kind of mapping. However, I have no idea if that would work, or is even needed, for a Collection/List of enum. Regards, Michael -Original Message- From: Patel Amit [mailto:[EMAIL PROTECTED] Sent: vendredi, 2. mai 2008 23:44 To: users@openjpa.apache.org Subject: List mapping of Enumerated Types Hello Jpa Community, I have a question on how to annotate a Collection of enums in my Entity. I have an Entity which has a List of Enums: private ListKeyUsuage keyUsuage = new ArrayListKeyUsuage(); Where KeyUsuage is the following enum: public enum KeyUsuage { digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment, keyAgreement, keyCertSign, CRLSign, encipherOnly, decipherOnly, AllExtendedKeyUsage; } How do I go about mapping this to a table. I imagine I do not need a join table, but a child table that has the owner entity ID, Enumerated String Value and a Sequence, but I do not know how to represent that in a @OneToMany annotation. Has anyone done this before or know how to do it? Is this possible in JPA? Thanks for the help. Amit This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
NPE at RelationToManyInverseKeyFieldStrategy when using mappedBy inverse
Hello, I'm running into an NPE in RelationToManyInverseKeyFieldStrategy (copy/pasted below) when using an OneToMany inverse relation with mappedBy and InheritanceType.TABLE_PER_CLASS in 1.1.0-SNAPSHOT... Test summary: A common abstract superclass Translatable which has a @OneToManySetTranslation, and many subclasses of that like e.g. a SomethingTranslatable, and many more. The idea is that mapping should lead to a Translation table holding the items for SomethingTranslatable and all other superclasses. Then SomethingTranslatable and many other tables (no physical Translatable table). There shouldn't be a join table for each SomethingTranslatable, as it's a OneToManySet, it doesn't make sense, so the owning side is a @ManyToOne in Translation back to Translatable. Granted a physical FK will not be possible in such a schema - accepted, but it should still be possible to map this? It works until I use @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) on Translatable, with it - boum, NPE. I have a standalone example (test) demonstrating this that I can put into a JIRA if anybody wants to have a look (it doesn't make it through list, or spam filter). Work-around may be to use a an InheritanceType.JOINED on the Translatable, which avoids the NPE (tested); and which in this exaxmple only leads to a basically empty physical Translatable (but allows physical FK). In the real-world example this is based on though, where the Translatable has more attributes (e.g. a kind of shortDefaultTranslation and longDefaultTranslation), and the real SomethingTranslatable are more complex, this leads to a lot of joins across a table hiearchy which we'd like to avoid. Am I doing something wrong? Not possible? Bug? Open a JIRA? Thanks for any idea, hints, things to try, etc.! _ Michael Vorburger, Odyssey Financial Technologies ___ Exception in thread main java.lang.NullPointerException at org.apache.openjpa.jdbc.meta.strats.RelationToManyInverseKeyFieldStrateg y.map(RelationToManyInverseKeyFieldStrategy.java:136) at org.apache.openjpa.jdbc.meta.strats.RelationCollectionInverseKeyFieldStr ategy.map(RelationCollectionInverseKeyFieldStrategy.java:95) at org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java: 120) at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(Ru ntimeStrategyInstaller.java:80) at org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.ja va:438) at org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:403) at org.apache.openjpa.jdbc.meta.ClassMapping.resolveMapping(ClassMapping.ja va:812) at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1626) at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataReposit ory.java:717) at org.apache.openjpa.meta.MetaDataRepository.resolveMapping(MetaDataReposi tory.java:677) at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.ja va:555) at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepositor y.java:308) at org.apache.openjpa.jdbc.meta.MappingRepository.getMapping(MappingReposit ory.java:284) at org.apache.openjpa.jdbc.meta.MappingTool.getMapping(MappingTool.java:676 ) at org.apache.openjpa.jdbc.meta.MappingTool.buildSchema(MappingTool.java:74 8) at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:646) at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:1072) at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:986) at atest.CreateDBTest.synchronizeDatabase(CreateDBTest.java:70) at atest.CreateDBTest.testCreateDerbyDB(CreateDBTest.java:31) at atest.CreateDBTest.main(CreateDBTest.java:35) This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: How to prebuild cascade types
Is there a way to do this without orm.xml, e.g. in persistence.xml? Or can you specify an orm.xml with for this, and leave the rest of mapping metadata in annotations? -Original Message- From: Patrick Linskey [mailto:[EMAIL PROTECTED] Sent: mardi, 29. avril 2008 16:43 To: users@openjpa.apache.org Subject: Re: How to prebuild cascade types Hi, Note that you can turn on CascadeType.PERSIST across the board (but can't subsequently turn it off) by setting the persistence-unit- defaults/cascade-persist element in orm.xml to true. -Patrick On Apr 29, 2008, at 5:30 AM, David Goodenough wrote: I want to have a single consistent cascade policy right through my application (or at least as a default that I can override only when needed). The standard enum allows for either specific operations, or ALL. So I through OK, lets declare a global variable as an array of CascadeType enums:- CascadeType[]defaultCascade = {CascadeType.PERSIST, CascadeType.MERGE,CascadeType.REFRESH}; and reference it in the annotations:- @ManyToOne(cascade=defaultCascade) but of course the annotation is a compile time thing, and I don't think that it can reach defaultCascade (even if it is final and static). Anyone got any ideas as to how to do this? David -- Patrick Linskey 202 669 5907 This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: One-Sided One-Many Mapping, but to different tables - missing @ElementEmbeddedMapping ?
Hello again, Actually, this doesn't work as expected for us after all... limitation: openjpa-1.1.0-SNAPSHOT-r422266:641891M fatal user error org.apache.openjpa.util.MetaDataException: X.yelement:class Y is mapped as embedded, but embedded field ... is not embeddable. Embedded element/key/value types are limited to simple fields and direct relations to other persistent types. The message is clear in what it means, but this actually limits the usefulness of this somewhat. (A colleague tells me in Hibernate this kind of mapping is possible.) I don't suppose there are any plans to address this limitation (or later version already have; I'm on a 1.1.0-SNAPSHOT.jar built from trunk as of 29.03.2008). Regards, Michael -Original Message- From: Michael Vorburger [mailto:[EMAIL PROTECTED] Sent: samedi, 29. mars 2008 03:14 To: users@openjpa.apache.org Subject: RE: One-Sided One-Many Mapping, but to different tables - missing @ElementEmbeddedMapping ? Patrick - I pulled an OpenJPA 1.1.0-SNAPSHOT from SVN and built it locally to give it a whirl - and indeed this appears to work like a charm! Great. Can anybody provide insight on about what timeframe your hoping to push v1.1 to a release? Roughly. PS: I'm using the following annotations: @PersistentCollection(elementEmbedded=true) @ContainerTable(name=RelA___RelB, [EMAIL PROTECTED](name=A_ID)) private SetRelB bs = new HashSetRelB(); Thanks! -Original Message- From: Patrick Linskey [mailto:[EMAIL PROTECTED] Sent: jeudi, 20. mars 2008 17:55 To: users@openjpa.apache.org Subject: Re: One-Sided One-Many Mapping, but to different tables - missing @ElementEmbeddedMapping ? Hi, You're describing the use case for the @Embeddable annotation in JPA. You're also describing a feature that's there in OpenJPA 1.1.0-SNAPSHOT but not in OpenJPA 1.0 -- embedded values in collections. Upgrade and things should work. FWIW, this behavior will be part of JPA2. -Patrick On Mon, Mar 17, 2008 at 11:07 AM, Michael Vorburger [EMAIL PROTECTED] wrote: Hi, I need to map the Elements contained in a OneToMany Collection (Set) in some class to one table, and Elements of the same Class Type contained in a OneToMany Collection (Set) in another class to another table. Know what I mean? The example on the Subscription/LineItem example from http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manua l/ manual.html#ref_guide_mapping_jpa_onemany works (of course), but imagine another class that holds the same kind of LineItem classes.. another @OneToMany @ElementJoinColumn will lead to another inverse foreign key mapping, and the one and only SUB table will have two; not what I want. Now before somebody says RTFM ;) - I read about the @PersistentCollection(elementEmbedded=true) @ContainerTable (in the OpenJPA doc just above the link above, but the example on http://edocs.bea.com/kodo/docs41/full/html/ref_guide_mapping_ejb.html# re f_guide_mapping_ejb_coll_ex helped) and it indeed does the mapping as I'm expecting it... but also adds a weired unneccassyary additional column of type 'image' (on Sybase, a BLOB on Derby) named after the Collection field (e.g. items) - on the LINE_ITEM instead of on the SUB table! How do I get rid of that column? I noticed Kodo has an @ElementEmbeddedMapping that's not in OpenJPA, but from what I understand that's only to override stuff? That @PersistentCollection(elementEmbedded=true) already says the Elements should be embedded. So why that additional binary column? Or this kind of mapping impossible with OpenJPA (it's clearly possible - there is just an additional annoying column...) Is there a way to do the same differently? BTW: I'm assuming somebody who would for some reason have two collections of LineItem in the Subscription class (instead of from two different classes) would probably have a very similar mapping requirement. Thanks! Michael * This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. * Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. * Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. * An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. * If you have received this email in error, please notify the sender immediately and delete the original. -- Patrick Linskey 202 669 5907 * This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use
RE: One-Sided One-Many Mapping, but to different tables - missing @ElementEmbeddedMapping ?
PS: I just saw that http://jcp.org/en/jsr/detail?id=317 (Java Persistence 2.0) says ... support for collections of embedded objects, multiple levels of embedded objects ... ... hm. Can anybody comment if there are plans for this? -Original Message- From: Michael Vorburger [mailto:[EMAIL PROTECTED] Sent: Tue 4/29/2008 7:48 PM To: users@openjpa.apache.org Subject: RE: One-Sided One-Many Mapping, but to different tables - missing @ElementEmbeddedMapping ? Hello again, Actually, this doesn't work as expected for us after all... limitation: openjpa-1.1.0-SNAPSHOT-r422266:641891M fatal user error org.apache.openjpa.util.MetaDataException: X.yelement:class Y is mapped as embedded, but embedded field ... is not embeddable. Embedded element/key/value types are limited to simple fields and direct relations to other persistent types. The message is clear in what it means, but this actually limits the usefulness of this somewhat. (A colleague tells me in Hibernate this kind of mapping is possible.) I don't suppose there are any plans to address this limitation (or later version already have; I'm on a 1.1.0-SNAPSHOT.jar built from trunk as of 29.03.2008). Regards, Michael -Original Message- From: Michael Vorburger [mailto:[EMAIL PROTECTED] Sent: samedi, 29. mars 2008 03:14 To: users@openjpa.apache.org Subject: RE: One-Sided One-Many Mapping, but to different tables - missing @ElementEmbeddedMapping ? Patrick - I pulled an OpenJPA 1.1.0-SNAPSHOT from SVN and built it locally to give it a whirl - and indeed this appears to work like a charm! Great. Can anybody provide insight on about what timeframe your hoping to push v1.1 to a release? Roughly. PS: I'm using the following annotations: @PersistentCollection(elementEmbedded=true) @ContainerTable(name=RelA___RelB, [EMAIL PROTECTED](name=A_ID)) private SetRelB bs = new HashSetRelB(); Thanks! -Original Message- From: Patrick Linskey [mailto:[EMAIL PROTECTED] Sent: jeudi, 20. mars 2008 17:55 To: users@openjpa.apache.org Subject: Re: One-Sided One-Many Mapping, but to different tables - missing @ElementEmbeddedMapping ? Hi, You're describing the use case for the @Embeddable annotation in JPA. You're also describing a feature that's there in OpenJPA 1.1.0-SNAPSHOT but not in OpenJPA 1.0 -- embedded values in collections. Upgrade and things should work. FWIW, this behavior will be part of JPA2. -Patrick On Mon, Mar 17, 2008 at 11:07 AM, Michael Vorburger [EMAIL PROTECTED] wrote: Hi, I need to map the Elements contained in a OneToMany Collection (Set) in some class to one table, and Elements of the same Class Type contained in a OneToMany Collection (Set) in another class to another table. Know what I mean? The example on the Subscription/LineItem example from http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manua l/ manual.html#ref_guide_mapping_jpa_onemany works (of course), but imagine another class that holds the same kind of LineItem classes.. another @OneToMany @ElementJoinColumn will lead to another inverse foreign key mapping, and the one and only SUB table will have two; not what I want. Now before somebody says RTFM ;) - I read about the @PersistentCollection(elementEmbedded=true) @ContainerTable (in the OpenJPA doc just above the link above, but the example on http://edocs.bea.com/kodo/docs41/full/html/ref_guide_mapping_ejb.html# re f_guide_mapping_ejb_coll_ex helped) and it indeed does the mapping as I'm expecting it... but also adds a weired unneccassyary additional column of type 'image' (on Sybase, a BLOB on Derby) named after the Collection field (e.g. items) - on the LINE_ITEM instead of on the SUB table! How do I get rid of that column? I noticed Kodo has an @ElementEmbeddedMapping that's not in OpenJPA, but from what I understand that's only to override stuff? That @PersistentCollection(elementEmbedded=true) already says the Elements should be embedded. So why that additional binary column? Or this kind of mapping impossible with OpenJPA (it's clearly possible - there is just an additional annoying column...) Is there a way to do the same differently? BTW: I'm assuming somebody who would for some reason have two collections of LineItem in the Subscription class (instead of from two different classes) would probably have a very similar mapping requirement. Thanks! Michael * This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. * Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. * Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically
RE: Swing JPQL console
https://jpaquerytool.dev.java.net/ -Original Message- From: Ognjen Blagojevic [mailto:[EMAIL PROTECTED] Sent: lundi, 31. mars 2008 10:15 To: users@openjpa.apache.org Subject: Re: Swing JPQL console Jan Kotek wrote: Hello, I am using OpenJPA with Derby in an astronomical opensource destkop application. Now I need JPQL console in my application. It should allow: * execute JPQL queries and display results * show syntax error of JPQL queries * display results in an table or tree * export this result somehow There is plenty of tools like this for SQL, so I wonder if something like that exists for JPQL. And if nothing exist, should I create it as independent library? It can be very usefull for debuging. I'm also interested for this kind of app. Right now, I'm using simple class to test the queries and print the results on the console. Regards, Ognjen This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: generate DDL script without database access
Hello, Has anybody here managed to successfully run the mappingtool connection-less in order to generate DDL script without database access? How?? The initial message below says if you put enough information into the openjpa.jdbc.DBDictionary setting, then things should work. and Re: Using DDL generation in a Java EE environment? post at http://mail-archives.apache.org/mod_mbox/openjpa-dev/200704.mbox/%3C77F5 [EMAIL PROTECTED] says you have to use a -SchemaFactory file(empty-schema.xml), so I'm tried like this: org.apache.openjpa.jdbc.meta.MappingTool -schemaAction build -foreignKeys true -sql target/create.sql -ConnectionDriverName com.sybase.jdbc3.jdbc.SybDriver -ConnectionURL jdbc:sybase:Tds:SOMEHOST:123/SOMEDB?BE_AS_JDBC_COMPLIANT_AS_POSSIBLE=tru e -ConnectionUserName SOMEUSER -ConnectionPassword SOMEPASS -SchemaFactory file(empty-schema.xml) with that empty-schema.xml containing only ?xml version=1.0 encoding=UTF-8?schemas/, but you still get the java.sql.SQLException from the JDBC Driver because it's trying to connect anyways... I tried with -schemaAction none too, but that just writes an empty (0 bytes) create.sql. What other options are needed (-record It's definitely possible to create the schema in the XML format via e.g. mappingtool -schemaAction build -foreignKeys true -schemaFile target/create.xml -ConnectionDriverName com.sybase.jdbc3.jdbc.SybDriver, but when you try to run e.g. schematool -f target/create.sql target/create.xml -ConnectionDriverName com.sybase.jdbc3.jdbc.SybDriver it again tries to connect to a DB! Looking at the code, the MappingTool.newSchemaTool(String action) does a SchemaTool tool = new SchemaTool(_conf, action). The SchemaTool constructor always tries a _ds = conf.getDataSource2(null) which does a test getConnection() deep inside JDBCConfigurationImpl()'s getConnectionFactory's through a DataSourceFactory.installDBDictionary(). I tried hacking that out, but there is more direct JDBC calls later... did anybody manage to successfully run the mappingtool connection-less? The Re: using mapping tool for DB2 offline thread from 08.04.2008 is about doing the same on DB2, where there seems to be a DB2-specific NPE (that was fixed in OPENJPA-555), so I'm guessing some folks do manage to generate DDL script without database access, but how?? Thanks. -Original Message- From: Frank Schwarz [mailto:[EMAIL PROTECTED] Sent: jeudi, 13. mars 2008 15:11 To: users@openjpa.apache.org Subject: Re: generate DDL script without database access Hi Patrick, thank you for your answer. The stack trace looks like this: openjpa-1.0.2-r420667:627158 fatal store error org.apache.openjpa.util.StoreException: Verbindung ist unterbrochen at org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(Dat aSourceFactory.java:234) at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory( JDBCConfigurationImpl.java:709) at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCCon figurationImpl.java:809) at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource2(JDBCCo nfigurationImpl.java:816) at org.apache.openjpa.jdbc.schema.SchemaTool.init(SchemaTool.java:127) at org.apache.openjpa.jdbc.meta.MappingTool.newSchemaTool(MappingTool.java: 306) at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:486) at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:1069) at org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn(MappingToolTask.ja va:197) at org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:172) Caused by: org.h2.jdbc.JdbcSQLException: Verbindung ist unterbrochen ... at org.h2.Driver.connect(Driver.java:52) at org.apache.openjpa.jdbc.schema.SimpleDriverDataSource.getConnection(Simp leDriverDataSource.java:73) at org.apache.openjpa.jdbc.schema.SimpleDriverDataSource.getConnection(Simp leDriverDataSource.java:68) at org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(Delegatin gDataSource.java:113) at org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(Decoratin gDataSource.java:93) at org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(Dat aSourceFactory.java:226) ... 26 more The connection is originally acquired in the constructor of org.apache.openjpa.jdbc.schema.SchemaTool. Kind regards, Frank Patrick Linskey schrieb: Hi, I believe that if you put enough information into the openjpa.jdbc.DBDictionary setting, then things should work. Where are you seeing the connection come from? I.e., what's the exception stack trace? -Patrick On Mon, Mar 10, 2008 at 3:08 AM, Frank Schwarz [EMAIL PROTECTED] wrote: Hi, is there a possibility to let OpenJPA create a SQL DDL script without accessing the database? I would like to apply this script later on to an empty database. I was in part successful with the mapping tool, alas it still tries to open a connection
RE: One-Sided One-Many Mapping, but to different tables - missing @ElementEmbeddedMapping ?
Patrick - I pulled an OpenJPA 1.1.0-SNAPSHOT from SVN and built it locally to give it a whirl - and indeed this appears to work like a charm! Great. Can anybody provide insight on about what timeframe your hoping to push v1.1 to a release? Roughly. PS: I'm using the following annotations: @PersistentCollection(elementEmbedded=true) @ContainerTable(name=RelA___RelB, [EMAIL PROTECTED](name=A_ID)) private SetRelB bs = new HashSetRelB(); Thanks! -Original Message- From: Patrick Linskey [mailto:[EMAIL PROTECTED] Sent: jeudi, 20. mars 2008 17:55 To: users@openjpa.apache.org Subject: Re: One-Sided One-Many Mapping, but to different tables - missing @ElementEmbeddedMapping ? Hi, You're describing the use case for the @Embeddable annotation in JPA. You're also describing a feature that's there in OpenJPA 1.1.0-SNAPSHOT but not in OpenJPA 1.0 -- embedded values in collections. Upgrade and things should work. FWIW, this behavior will be part of JPA2. -Patrick On Mon, Mar 17, 2008 at 11:07 AM, Michael Vorburger [EMAIL PROTECTED] wrote: Hi, I need to map the Elements contained in a OneToMany Collection (Set) in some class to one table, and Elements of the same Class Type contained in a OneToMany Collection (Set) in another class to another table. Know what I mean? The example on the Subscription/LineItem example from http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manua l/ manual.html#ref_guide_mapping_jpa_onemany works (of course), but imagine another class that holds the same kind of LineItem classes.. another @OneToMany @ElementJoinColumn will lead to another inverse foreign key mapping, and the one and only SUB table will have two; not what I want. Now before somebody says RTFM ;) - I read about the @PersistentCollection(elementEmbedded=true) @ContainerTable (in the OpenJPA doc just above the link above, but the example on http://edocs.bea.com/kodo/docs41/full/html/ref_guide_mapping_ejb.html# re f_guide_mapping_ejb_coll_ex helped) and it indeed does the mapping as I'm expecting it... but also adds a weired unneccassyary additional column of type 'image' (on Sybase, a BLOB on Derby) named after the Collection field (e.g. items) - on the LINE_ITEM instead of on the SUB table! How do I get rid of that column? I noticed Kodo has an @ElementEmbeddedMapping that's not in OpenJPA, but from what I understand that's only to override stuff? That @PersistentCollection(elementEmbedded=true) already says the Elements should be embedded. So why that additional binary column? Or this kind of mapping impossible with OpenJPA (it's clearly possible - there is just an additional annoying column...) Is there a way to do the same differently? BTW: I'm assuming somebody who would for some reason have two collections of LineItem in the Subscription class (instead of from two different classes) would probably have a very similar mapping requirement. Thanks! Michael * This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. * Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. * Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. * An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. * If you have received this email in error, please notify the sender immediately and delete the original. -- Patrick Linskey 202 669 5907 This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: Foreign Key constraints on Sybase?
Continuing on with my monologue on this thread... The attached patch (does it make it through the list?) removes the getAddForeignKeySQL() with the return new String[0]; from the SybaseDictionary. I did a brief test, and with this, and property name=openjpa.jdbc.MappingDefaults value=ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict / (no cascasde) I get the ALTER TABLE on Sybase, and as explained below, that's perfectly valid. -- Using http://openjpa.apache.org/unit-tests.html I could check if this patch has no other side effects when running on Sybase if that would help in getting it commited by one of you? (Unfortunately I currently get Tests run: 839, Failures: 0, Errors: 5, Skipped: 0 from trunk, so can't really test...) Can I become commiter if I continue on like this? ;-) Regards, Michael -Original Message- From: Michael Vorburger [mailto:[EMAIL PROTECTED] Sent: vendredi, 29. février 2008 10:11 To: users@openjpa.apache.org Subject: RE: Foreign Key constraints on Sybase? self.reply ;-) with what I learnt from our DB expert about this since writing for future Googlers: Sybase indeed SUPPORTS foreign key constraints (ALTER TABLE A_B ADD FOREIGN KEY (A_id) REFERENCES A (id);). The SybaseDictionary MUST emit these (ignore cascades), IMHO. I'd argue this is an OpenJPA bug? Sybase does unfortunately NOT seem to support ... ON DELETE CASCADE. A (simple!) TSQL stored proc is typically written for this functionality. SybaseDictionary COULD probably generate such stored procs for ideal Sybase support. Comments, anybody? -Original Message- From: Michael Vorburger [mailto:[EMAIL PROTECTED] Sent: mardi, 26. février 2008 19:57 To: users@openjpa.apache.org Subject: Foreign Key constraints on Sybase? Hello, I am trying to get Foreign Key constraints generated by the mappingtool on Sybase. After some doc reading and playing around I found mappingtool ... -foreignKeys true, and tried e.g. property name=openjpa.jdbc.MappingDefaults value=ForeignKeyDeleteAction=cascade, JoinForeignKeyDeleteAction=restrict / !-- Or just restrict? -- and tried the @ElementForeignKey annotation too, but no mater what, I was constantly awarded with sad messages like this one only: 1877 Test-JPA WARN [main] openjpa.jdbc.Schema - The foreign key foreignkey was not added to table A. I played around with this some more (too long) until it occured to me to try switching to Derby just for a try - and I got the ALTER TABLE A_B ADD FOREIGN KEY (A_id) REFERENCES A (id); kind of DDL! So this wasn't my missconfiguration as I had assumed for hours, but a [EMAIL PROTECTED] problem?? Then I dug into the SybaseDictionary and found this: public String[] getAddForeignKeySQL(ForeignKey fk) { // Sybase has problems with adding foriegn keys via ALTER TABLE command return new String[0]; } why are you doing this?? As far as I can tell, an ALTER TABLE like the one shown above seems to be pass just fine on Sybase... so what's the deal with Foreign Key constraints on Sybase in OpenJPA? There is nothing documented on http://openjpa.apache.org/docs/latest/manual/dbsupport_sybase.html#dbsup port_sybase_issues about this. Thank you very much, Michael PS: I did notice Sybase doesn't seem to like ... ON DELETE CASCADE, I will ask somebody here who speaks Sybase SQL more fluently than I do about this. Surely there is an alternative syntax? _ Michael Vorburger, Odyssey Financial Technologies Direct phone: +41 21 310 00 86 (OAMS VOIP: 1086) Cell phone: +41 78 805 5541 Mailto: [EMAIL PROTECTED] * This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. * Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. * Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. * An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. * If you have received this email in error, please notify the sender immediately and delete the original. * This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. * Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. * Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. * An electronic message
One-Sided One-Many Mapping, but to different tables - missing @ElementEmbeddedMapping ?
Hi, I need to map the Elements contained in a OneToMany Collection (Set) in some class to one table, and Elements of the same Class Type contained in a OneToMany Collection (Set) in another class to another table. Know what I mean? The example on the Subscription/LineItem example from http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/ manual.html#ref_guide_mapping_jpa_onemany works (of course), but imagine another class that holds the same kind of LineItem classes.. another @OneToMany @ElementJoinColumn will lead to another inverse foreign key mapping, and the one and only SUB table will have two; not what I want. Now before somebody says RTFM ;) - I read about the @PersistentCollection(elementEmbedded=true) @ContainerTable (in the OpenJPA doc just above the link above, but the example on http://edocs.bea.com/kodo/docs41/full/html/ref_guide_mapping_ejb.html#re f_guide_mapping_ejb_coll_ex helped) and it indeed does the mapping as I'm expecting it... but also adds a weired unneccassyary additional column of type 'image' (on Sybase, a BLOB on Derby) named after the Collection field (e.g. items) - on the LINE_ITEM instead of on the SUB table! How do I get rid of that column? I noticed Kodo has an @ElementEmbeddedMapping that's not in OpenJPA, but from what I understand that's only to override stuff? That @PersistentCollection(elementEmbedded=true) already says the Elements should be embedded. So why that additional binary column? Or this kind of mapping impossible with OpenJPA (it's clearly possible - there is just an additional annoying column...) Is there a way to do the same differently? BTW: I'm assuming somebody who would for some reason have two collections of LineItem in the Subscription class (instead of from two different classes) would probably have a very similar mapping requirement. Thanks! Michael This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
Autofetch - auto-magically add association prefetches to ORM object queries to reduce the number of round-trips to an object store
Hi, Have you seen this thing, AutoFetch? The idea is auto-magically add association fetch-group to reduce the number of round-trips to store... see: http://www.theserverside.com/news/thread.tss?thread_id=48540#248673 http://www.cs.utexas.edu/~aibrahim/autofetch/ https://sourceforge.net/projects/autofetch/ Do you think this idea is conceptually interesting and worthwhile, or are you sceptical that this can work? Why? Note that the author expresses an interest to port this to OpenJPA on TSS... maybe he could use some help? ;-) Regards, Michael _ Michael Vorburger, Odyssey Financial Technologies Direct phone: +41 21 310 00 86 (OAMS VOIP: 1086) Cell phone: +41 78 805 5541 Mailto: [EMAIL PROTECTED] This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: Foreign Key constraints on Sybase?
self.reply ;-) with what I learnt from our DB expert about this since writing for future Googlers: Sybase indeed SUPPORTS foreign key constraints (ALTER TABLE A_B ADD FOREIGN KEY (A_id) REFERENCES A (id);). The SybaseDictionary MUST emit these (ignore cascades), IMHO. I'd argue this is an OpenJPA bug? Sybase does unfortunately NOT seem to support ... ON DELETE CASCADE. A (simple!) TSQL stored proc is typically written for this functionality. SybaseDictionary COULD probably generate such stored procs for ideal Sybase support. Comments, anybody? -Original Message- From: Michael Vorburger [mailto:[EMAIL PROTECTED] Sent: mardi, 26. février 2008 19:57 To: users@openjpa.apache.org Subject: Foreign Key constraints on Sybase? Hello, I am trying to get Foreign Key constraints generated by the mappingtool on Sybase. After some doc reading and playing around I found mappingtool ... -foreignKeys true, and tried e.g. property name=openjpa.jdbc.MappingDefaults value=ForeignKeyDeleteAction=cascade, JoinForeignKeyDeleteAction=restrict / !-- Or just restrict? -- and tried the @ElementForeignKey annotation too, but no mater what, I was constantly awarded with sad messages like this one only: 1877 Test-JPA WARN [main] openjpa.jdbc.Schema - The foreign key foreignkey was not added to table A. I played around with this some more (too long) until it occured to me to try switching to Derby just for a try - and I got the ALTER TABLE A_B ADD FOREIGN KEY (A_id) REFERENCES A (id); kind of DDL! So this wasn't my missconfiguration as I had assumed for hours, but a [EMAIL PROTECTED] problem?? Then I dug into the SybaseDictionary and found this: public String[] getAddForeignKeySQL(ForeignKey fk) { // Sybase has problems with adding foriegn keys via ALTER TABLE command return new String[0]; } why are you doing this?? As far as I can tell, an ALTER TABLE like the one shown above seems to be pass just fine on Sybase... so what's the deal with Foreign Key constraints on Sybase in OpenJPA? There is nothing documented on http://openjpa.apache.org/docs/latest/manual/dbsupport_sybase.html#dbsup port_sybase_issues about this. Thank you very much, Michael PS: I did notice Sybase doesn't seem to like ... ON DELETE CASCADE, I will ask somebody here who speaks Sybase SQL more fluently than I do about this. Surely there is an alternative syntax? _ Michael Vorburger, Odyssey Financial Technologies Direct phone: +41 21 310 00 86 (OAMS VOIP: 1086) Cell phone: +41 78 805 5541 Mailto: [EMAIL PROTECTED] * This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. * Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. * Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. * An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. * If you have received this email in error, please notify the sender immediately and delete the original. This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
JPA Spec JAR - RE: multiple persistence-units, each w different provider
Is there any particular reason why OpenJPA uses the geronimo-jpa_3.0_spec-1.0.jar instead of the http://mvnrepository.com/artifact/javax.persistence/persistence-api/1.0 from https://glassfish.dev.java.net/javaee5/persistence/ (https://glassfish.dev.java.net/source/browse/glassfish/persistence-api/). Is it OSS Licensing mess, use of a CDDL API JAR in a APL libraray a problem? BTW: I noticed that the persistence-api-1.0-sources.jar (e.g. from http://mirrors.ibiblio.org/pub/mirrors/maven2/javax/persistence/persistence-api/1.0/) have JavaDoc... while the geronimo-jpa_3.0_spec-1.0-sources.jar or geronimo-jpa_3.0_spec-1.0-javadoc.jar don't. If you use Source Attachment in e.g. Eclipse this is handy... Would there be any risk if locally we overwrote dependencies so that developers in our org would use OpenJPA with the persistence-api-1.0.jar instead of the geronimo-jpa_3.0_spec-1.0.jar (in order to have JavaDoc Help in Eclipse?). Probably not - why would there be? Is this allowed (more out of curiosity), license wise? Presumably yes? Regards, Michael Vorburger -Original Message- From: Patrick Linskey [mailto:[EMAIL PROTECTED] Sent: vendredi, 29. février 2008 01:42 To: users@openjpa.apache.org Subject: Re: multiple persistence-units, each w different provider Hi, I think that the official copy is the one at Glassfish. -Patrick On Thu, Feb 28, 2008 at 2:15 AM, Adam Hardy [EMAIL PROTECTED] wrote: I have three persistence-unit nodes in my persistence.xml: one for Toplink with the toplink provider specified, one for Hibernate, and one for OpenJPA. It tests various operations in JPA, configured to use whichever JPA supplier I specify at the time, i.e. I just change the name of the persistence-unit I pass to Persistence.createEntityManagerFactory(). So I have, for instance at the moment, not only openjpa.jar on the classpath, but also hibernate-entitymanager.jar and toplink-essentials.jar. When running my test, due to the way javax.persistence.Persistence.class is programmed, any of those providers may be picked for use, without reference to the name of the persistence-unit name that I specified when calling createEntityManagerFactory() - somewhat surprisingly! If my memory serves me well, the persistence-api.jar that I am using is just the one that maven downloaded automatically from the global jar repo. I'm tempted to create my own javax.persistence.Persistence to do it properly and position it ahead of the persistence-api.jar on my classpath. This just doesn't seem right. I guess I should be asking at Sun. Was it Sun who wrote javax.persistence.Persistence ? Or are there different versions? Is there an 'OpenJPA persistence-api'? Has anyone here written their own and made it publicly available? Thanks Adam -- Patrick Linskey 202 669 5907 This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
Foreign Key constraints on Sybase?
Hello, I am trying to get Foreign Key constraints generated by the mappingtool on Sybase. After some doc reading and playing around I found mappingtool ... -foreignKeys true, and tried e.g. property name=openjpa.jdbc.MappingDefaults value=ForeignKeyDeleteAction=cascade, JoinForeignKeyDeleteAction=restrict / !-- Or just restrict? -- and tried the @ElementForeignKey annotation too, but no mater what, I was constantly awarded with sad messages like this one only: 1877 Test-JPA WARN [main] openjpa.jdbc.Schema - The foreign key foreignkey was not added to table A. I played around with this some more (too long) until it occured to me to try switching to Derby just for a try - and I got the ALTER TABLE A_B ADD FOREIGN KEY (A_id) REFERENCES A (id); kind of DDL! So this wasn't my missconfiguration as I had assumed for hours, but a [EMAIL PROTECTED] problem?? Then I dug into the SybaseDictionary and found this: public String[] getAddForeignKeySQL(ForeignKey fk) { // Sybase has problems with adding foriegn keys via ALTER TABLE command return new String[0]; } why are you doing this?? As far as I can tell, an ALTER TABLE like the one shown above seems to be pass just fine on Sybase... so what's the deal with Foreign Key constraints on Sybase in OpenJPA? There is nothing documented on http://openjpa.apache.org/docs/latest/manual/dbsupport_sybase.html#dbsup port_sybase_issues about this. Thank you very much, Michael PS: I did notice Sybase doesn't seem to like ... ON DELETE CASCADE, I will ask somebody here who speaks Sybase SQL more fluently than I do about this. Surely there is an alternative syntax? _ Michael Vorburger, Odyssey Financial Technologies Direct phone: +41 21 310 00 86 (OAMS VOIP: 1086) Cell phone: +41 78 805 5541 Mailto: [EMAIL PROTECTED] This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: Reserved keywords mechanism working?
Hi again - any chance somebody could clarify what the OpenJPA option is that will turn on renaming to avoid clashes of Java class/field names with RDBMS reserved words? Thanks a lot! -Original Message- From: Michael Vorburger [mailto:[EMAIL PROTECTED] Sent: samedi, 19. janvier 2008 00:27 To: users@openjpa.apache.org Subject: RE: Reserved keywords mechanism working? and the JPA spec mandates how field and column names are converted by default. Dumb Spec! :-) the second part is why OpenJPA isn't doing any conversion of the columns automatically. There is an option that will turn on the renaming. Would you enlighten us what that option is? Looked but couldn't anything in User's Guide.. sorry. OpenJPA is not properly escaping reserved words The first part is the salient bug Not sure I understand this one; if it's a reserved word on some DB, you can't escape it to create a table or column named like the reserved word, can you? I'm probably missing your point. - Not important, I'm assuming the option you mention will do what I want. (Bug if 'it' is a bug, have it in your JIRA already?) Thanks! -Original Message- From: Patrick Linskey [mailto:[EMAIL PROTECTED] Sent: Fri 1/18/2008 9:56 AM To: users@openjpa.apache.org Subject: Re: Reserved keywords mechanism working? Hello there again! ;-) Hello! Is that Reserved keywords mechanism in the DBDictionary stuff maybe broken, or am I dumb or missing something obvious? The problem is twofold: OpenJPA is not properly escaping reserved words, and the JPA spec mandates how field and column names are converted by default. The first part is the salient bug; the second part is why OpenJPA isn't doing any conversion of the columns automatically. There is an option that will turn on the renaming. -Patrick On Jan 17, 2008 11:15 AM, Michael Vorburger [EMAIL PROTECTED] wrote: Hello there again! ;-) Is that Reserved keywords mechanism in the DBDictionary stuff maybe broken, or am I dumb or missing something obvious? With OpenJPA 1.0.1, if I take the examples/hellojpa, which runs fine unmodified, and add a @Basic private String group; to the Message.java, you get the copy/pasted error below. As if something was wrong with the reservedWords mechanism in the DBDictionary which reads sql-keywords.rsrc and extends the list in e.g. DerbyDictionary? The correct dictionary DOES appear to be in use, according to the log below. The problem doesn't seem to be limited to Derby; I initially played around on a Sybase, and there again (another) keyword listed in the sql-keywords.rsrc isn't picked up. An aside, may be separate or may be related: On same Sybase I'm also getting e.g. org.apache.openjpa.lib.jdbc.ReportingSQLException: The identifier that starts with 'effectiveMarketSegmentCheckedF' is too long. Maximum length is 30. problems - despite the SybaseDictionary having a maxColumnNameLength = 30. Do I have to activate anything? Am I missing something? This stuff is supposed to work out of the box, I would have thought? Any ideas? Regards and thanks, Michael _ Michael Vorburger, Odyssey Financial Technologies (...) _ WITH existing DB, when ALTERing: run: [java] 47 hellojpa INFO [main] openjpa.Runtime - Starting OpenJPA 1.0.1 [java] 125 hellojpa INFO [main] openjpa.jdbc.JDBC - Using dictionary class org.apache.openjpa.jdbc.sql.DerbyDictionary. [java] 2156 hellojpa TRACE [main] openjpa.jdbc.SQL - t 19206130, conn 3803825 executing stmnt 9564165 ALTER TABLE Message ADD group VARCHAR(255) [java] 2188 hellojpa TRACE [main] openjpa.jdbc.SQL - t 19206130, conn 3803825 [32 ms] spent [java] Exception in thread main openjpa-1.0.1-r420667:592145 nonfatal general error org.apache.openjpa.persistence.PersistenceException: Syntax error: Encountered group. {stmnt 9564165 ALTER TABLE Message ADD group VARCHAR(255)} [code=3, state=42X01] [java] at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:549) [java] at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:449) [java] at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(J DB CBrokerFactory.java:170) [java] at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBro ke rFactory.java:130) [java] at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrok er Factory.java:186) [java] at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(Delegating Br okerFactory.java:142) [java] at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMa na ger(EntityManagerFactoryImpl.java:192) [java] at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMa na ger(EntityManagerFactoryImpl.java:145) [java
RE: Reserved keywords mechanism working?
and the JPA spec mandates how field and column names are converted by default. Dumb Spec! :-) the second part is why OpenJPA isn't doing any conversion of the columns automatically. There is an option that will turn on the renaming. Would you enlighten us what that option is? Looked but couldn't anything in User's Guide.. sorry. OpenJPA is not properly escaping reserved words The first part is the salient bug Not sure I understand this one; if it's a reserved word on some DB, you can't escape it to create a table or column named like the reserved word, can you? I'm probably missing your point. - Not important, I'm assuming the option you mention will do what I want. (Bug if 'it' is a bug, have it in your JIRA already?) Thanks! -Original Message- From: Patrick Linskey [mailto:[EMAIL PROTECTED] Sent: Fri 1/18/2008 9:56 AM To: users@openjpa.apache.org Subject: Re: Reserved keywords mechanism working? Hello there again! ;-) Hello! Is that Reserved keywords mechanism in the DBDictionary stuff maybe broken, or am I dumb or missing something obvious? The problem is twofold: OpenJPA is not properly escaping reserved words, and the JPA spec mandates how field and column names are converted by default. The first part is the salient bug; the second part is why OpenJPA isn't doing any conversion of the columns automatically. There is an option that will turn on the renaming. -Patrick On Jan 17, 2008 11:15 AM, Michael Vorburger [EMAIL PROTECTED] wrote: Hello there again! ;-) Is that Reserved keywords mechanism in the DBDictionary stuff maybe broken, or am I dumb or missing something obvious? With OpenJPA 1.0.1, if I take the examples/hellojpa, which runs fine unmodified, and add a @Basic private String group; to the Message.java, you get the copy/pasted error below. As if something was wrong with the reservedWords mechanism in the DBDictionary which reads sql-keywords.rsrc and extends the list in e.g. DerbyDictionary? The correct dictionary DOES appear to be in use, according to the log below. The problem doesn't seem to be limited to Derby; I initially played around on a Sybase, and there again (another) keyword listed in the sql-keywords.rsrc isn't picked up. An aside, may be separate or may be related: On same Sybase I'm also getting e.g. org.apache.openjpa.lib.jdbc.ReportingSQLException: The identifier that starts with 'effectiveMarketSegmentCheckedF' is too long. Maximum length is 30. problems - despite the SybaseDictionary having a maxColumnNameLength = 30. Do I have to activate anything? Am I missing something? This stuff is supposed to work out of the box, I would have thought? Any ideas? Regards and thanks, Michael _ Michael Vorburger, Odyssey Financial Technologies (...) _ WITH existing DB, when ALTERing: run: [java] 47 hellojpa INFO [main] openjpa.Runtime - Starting OpenJPA 1.0.1 [java] 125 hellojpa INFO [main] openjpa.jdbc.JDBC - Using dictionary class org.apache.openjpa.jdbc.sql.DerbyDictionary. [java] 2156 hellojpa TRACE [main] openjpa.jdbc.SQL - t 19206130, conn 3803825 executing stmnt 9564165 ALTER TABLE Message ADD group VARCHAR(255) [java] 2188 hellojpa TRACE [main] openjpa.jdbc.SQL - t 19206130, conn 3803825 [32 ms] spent [java] Exception in thread main openjpa-1.0.1-r420667:592145 nonfatal general error org.apache.openjpa.persistence.PersistenceException: Syntax error: Encountered group. {stmnt 9564165 ALTER TABLE Message ADD group VARCHAR(255)} [code=3, state=42X01] [java] at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:549) [java] at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:449) [java] at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDB CBrokerFactory.java:170) [java] at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBroke rFactory.java:130) [java] at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBroker Factory.java:186) [java] at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBr okerFactory.java:142) [java] at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana ger(EntityManagerFactoryImpl.java:192) [java] at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana ger(EntityManagerFactoryImpl.java:145) [java] at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana ger(EntityManagerFactoryImpl.java:56) [java] at hellojpa.Main.main(Main.java:43) [java] Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Syntax error: Encountered group at line 1, column 25. {stmnt 9564165 ALTER TABLE Message ADD group VARC, state=42X01] [java] at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConne
Reserved keywords mechanism working?
Hello there again! ;-) Is that Reserved keywords mechanism in the DBDictionary stuff maybe broken, or am I dumb or missing something obvious? With OpenJPA 1.0.1, if I take the examples/hellojpa, which runs fine unmodified, and add a @Basic private String group; to the Message.java, you get the copy/pasted error below. As if something was wrong with the reservedWords mechanism in the DBDictionary which reads sql-keywords.rsrc and extends the list in e.g. DerbyDictionary? The correct dictionary DOES appear to be in use, according to the log below. The problem doesn't seem to be limited to Derby; I initially played around on a Sybase, and there again (another) keyword listed in the sql-keywords.rsrc isn't picked up. An aside, may be separate or may be related: On same Sybase I'm also getting e.g. org.apache.openjpa.lib.jdbc.ReportingSQLException: The identifier that starts with 'effectiveMarketSegmentCheckedF' is too long. Maximum length is 30. problems - despite the SybaseDictionary having a maxColumnNameLength = 30. Do I have to activate anything? Am I missing something? This stuff is supposed to work out of the box, I would have thought? Any ideas? Regards and thanks, Michael _ Michael Vorburger, Odyssey Financial Technologies (...) _ WITH existing DB, when ALTERing: run: [java] 47 hellojpa INFO [main] openjpa.Runtime - Starting OpenJPA 1.0.1 [java] 125 hellojpa INFO [main] openjpa.jdbc.JDBC - Using dictionary class org.apache.openjpa.jdbc.sql.DerbyDictionary. [java] 2156 hellojpa TRACE [main] openjpa.jdbc.SQL - t 19206130, conn 3803825 executing stmnt 9564165 ALTER TABLE Message ADD group VARCHAR(255) [java] 2188 hellojpa TRACE [main] openjpa.jdbc.SQL - t 19206130, conn 3803825 [32 ms] spent [java] Exception in thread main openjpa-1.0.1-r420667:592145 nonfatal general error org.apache.openjpa.persistence.PersistenceException: Syntax error: Encountered group. {stmnt 9564165 ALTER TABLE Message ADD group VARCHAR(255)} [code=3, state=42X01] [java] at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:549) [java] at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:449) [java] at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDB CBrokerFactory.java:170) [java] at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBroke rFactory.java:130) [java] at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBroker Factory.java:186) [java] at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBr okerFactory.java:142) [java] at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana ger(EntityManagerFactoryImpl.java:192) [java] at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana ger(EntityManagerFactoryImpl.java:145) [java] at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana ger(EntityManagerFactoryImpl.java:56) [java] at hellojpa.Main.main(Main.java:43) [java] Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Syntax error: Encountered group at line 1, column 25. {stmnt 9564165 ALTER TABLE Message ADD group VARC, state=42X01] [java] at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConne ctionDecorator.java:192) [java] at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$800(Loggin gConnectionDecorator.java:57) [java] at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection $LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:754) [java] at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(Delegating Statement.java:114) [java] at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:118 5) [java] at org.apache.openjpa.jdbc.schema.SchemaTool.addColumn(SchemaTool.java:1020 ) [java] at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:481) [java] at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344) [java] at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321) [java] at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:497) [java] ... 9 more BUILD FAILED C:\bin\jpa_apache-openjpa-1.0.1-binary\examples\build.xml:84: Java returned: 1 Total time: 5 seconds C:\bin\jpa_apache-openjpa-1.0.1-binary\examples\hellojpa ___ With fresh DB, when CREATEing: run: [java] 47 hellojpa INFO [main] openjpa.Runtime - Starting OpenJPA 1.0.1 [java] 125 hellojpa INFO [main] openjpa.jdbc.JDBC - Using dictionary class org.apache.openjpa.jdbc.sql.DerbyDictionary. [java] 7206 hellojpa TRACE [main] openjpa.jdbc.SQL - t 21943671, conn 10526273 executing stmnt 33116517 CREATE TABLE Message (id BIGINT