{"id":6029,"date":"2014-04-12T00:29:13","date_gmt":"2014-04-12T00:29:13","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/12\/openjparelated-issues-collection-of-common-programming-errors\/"},"modified":"2014-04-12T00:29:13","modified_gmt":"2014-04-12T00:29:13","slug":"openjparelated-issues-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/12\/openjparelated-issues-collection-of-common-programming-errors\/","title":{"rendered":"openjpaRelated issues-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/71913d1f88c59c28c59f99db7d04be34?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nLord_Herman<br \/>\njava jpa junit4 hashcode openjpa<br \/>\nDespite all the controversy with equals\/hashCode and JPA I&#8217;m dealing with a problem reminds me &#8220;What was 1st? The egg or the hen?I&#8217;m using JPA for implementing my persistence layer, and JUnit 4 for testin it, the problem is if I override equals and hashCode methods, JUnit test raises an exception I can&#8217;t understand. For some time I&#8217;ve ignored those 2 method, but if i need to use @Embeded classes I must override them. So, if I ignore those 2 method I can&#8217;t use @Embeded classes, and if I use those<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/88efa534b9a4305e7e30da4c7d568e2c?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nSotirios Delimanolis<br \/>\njava spring jpa openjpa<br \/>\nThis question already has an answer here:Why is my Spring @Autowired field null?1 answerapplicationContext.xml&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt; &lt;beans xmlns=&#8221;http:\/\/www.springframework.org\/schema\/beans&#8221; xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xmlns:context=&#8221;http:\/\/www.springframework.org\/schema\/context&#8221; xmlns:aop=&#8221;http:\/\/www.springframework.org\/schema\/aop&#8221; xmlns:tx=&#8221;http:\/\/www.springframework.org\/schema\/tx&#8221; xmlns:p=&#8221;http:\/\/www.springframework.org\/schema\/p&#8221; xmlns:cache<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7956fba76df0f2173817fb88df7168b5?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser1595858<br \/>\njboss7.x slf4j openjpa openjpa-maven-plugin<br \/>\nMy EAR application runs fine when i don&#8217;t use openJpa. Once i use open JPA i get the &#8220;SLF4J fail to load class blaaa &#8220;. How to configure the openJpa module to use the SL4J which i provide from pom.xml and avoid that error?I use JBOSS 7.1.1pom.xml&lt;properties&gt;&lt;slf4j.version&gt;1.7.3&lt;\/slf4j.version&gt;&lt;logback.version&gt;1.0.10&lt;\/logback.version&gt;&lt;\/properties&gt;&lt;dependency&gt;&lt;groupId&gt;org.slf4j&lt;\/groupId&gt;&lt;artifactId&gt;slf4j-api&lt;\/artifactId&gt;&lt;version&amp;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/056c10bdd1c502dcbe215d4915d8ab00?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJaime Alvarez<br \/>\njava jpa websphere openjpa<br \/>\nI&#8217;m new in JPA.I&#8217;ve created a JPA Entity (see below). When I try to use it from a java client when I insert one record into the database I have the following exception (see below)Any Ideas to try to skip this eror?The Client:package co.ne.staffmanagement.test;import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.EntityTransaction; import javax.persistence.Persistence;import co.ne.staffmanagement.domain.Employee;public class TestHarness {<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/92b3b89f929a03736caed40d4197a180?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nseba.wagner<br \/>\njava serialization jpa red5 openjpa<br \/>\nMy framework seems to have issues with a special entity that constantly fails to get serialized with an exception.Entity: http:\/\/svn.apache.org\/viewvc\/incubator\/openmeetings\/trunk\/singlewebapp\/src\/org\/apache\/openmeetings\/persistence\/beans\/basic\/Server.java?view=markupMy theory: The serializer uses the enhanced class from OpenJPA, and it cannot serialize it. But I have no idea how this can only happen with this entity and all other work fine.Exception:WARN: Exception: java.lang.reflect.Invocatio<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/sDUv2.jpg?s=32&amp;g=1\" \/><br \/>\nWlad<br \/>\njava-ee jpa ejb openjpa<br \/>\nI am trying to create database from annotated EJB entities. Using: Eclipse, Ant tool, Apache Tomee server, OpenJPA, JEE\/EJB&#8217;s, MySQL db.My app fails during injecting entity manager(that is suppose to trigger db creation following annotated entity classes). Some crucial app parts:Exception i am getting looks like this:prepare-database:[echo] Inserting default user into database.[java] Dec 09, 2013 9:45:29 AM org.apache.openejb.client.EventLogger log[java] INFO: RemoteInitialContextCreated{provide<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/Ktxh0.png?s=32&amp;g=1\" \/><br \/>\nVladS<br \/>\njava classloader openjpa weblogic-10.x<br \/>\nit&#8217;s difficult to describe case so below short case and result of my investigation:Environment:java 1.6 weblogic-10.3.6.0 openjpa &#8211; 1.1.0 spring &#8211; 3.2 Two persistence-unit in one persistence.xml (A and R)Case:Deploy war file to weblogic is successful Stop app in admin console Try start app &#8211; it&#8217;s Failed Try start again &#8211; it&#8217;s success!stacktraceweblogic.application.ModuleException: :org.apache.openjpa.persistence.ArgumentException:Table &#8220;ACTION_COMMENT&#8221; given for &#8220;&#8230;&#8230;ActionComment&#8221;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/709f8e637bd460ef6fa70f0e221bc0fe?s=128&amp;d=identicon&amp;r=PG\" \/><br \/>\nLukasz ? L ?<br \/>\njpql openjpa<br \/>\nCan I do something like this on JPQL?SELECT NEW com.MyDTO(p.a, p.b, q.c, q.d) FROM (SELECT r.* FROM MyDTO1 r ) p LEFT OUTER JOIN (SELECT s.* FROM MyDTO2 s ) q ON p.x = q.y or similar? (Above query has mixed with native and JPQL, so don&#8217;t misunderstand)I&#8217;m having a problem with this part I think.FROM (SELECT r.* FROM MyDTO1 r ) pWhen I&#8217;m trying to execute I&#8217;m getting this error.Exception Description: Syntax error parsing the query [&#8230;..], unexpected token [(]Thank you!<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/3d0d488d8f5e21a974c9671db6407d50?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nGnavvy<br \/>\nhibernate jdbc fetch openjpa toplink<br \/>\nOpenJPA provided some parameter in the FetchPlan. (http:\/\/openjpa.apache.org\/builds\/1.2.0\/apidocs\/org\/apache\/openjpa\/persistence\/FetchPlan.html) And I was stuck in one of them, the FetchBatchSize. Hope someone can kindly share their experience.Here is the scenario, say I was going select up to 1000 record from the database(MS-SQL) 1. if I left FetchBatchSize to its default value -1, it will take some 20 seconds to return the 1000 records;if I set the FetchBatchSize to 100, the time cost was redu<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7504b530d1df33b972a3431d3640f618?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nChris Travers<br \/>\njava openjpa<br \/>\nafter creating my entities with the OpenJPA&#8217;s ReverseMappingTool I recognized that the tool mapped the db-fieldtype &#8220;intversion numeric(9,0) NOT NULL&#8221; of my postgres-DB to private double intversion; in my java-file. Since there is a zero after the decimal point I just don&#8217;t understand why the field is mapped to double and not to int? Change I change that? I want an int or an Integer in my Java-Class without changing the db-structure.The point is, that the files are generated at runtime, so ther<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lord_Herman java jpa junit4 hashcode openjpa Despite all the controversy with equals\/hashCode and JPA I&#8217;m dealing with a problem reminds me &#8220;What was 1st? The egg or the hen?I&#8217;m using JPA for implementing my persistence layer, and JUnit 4 for testin it, the problem is if I override equals and hashCode methods, JUnit test raises [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6029","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6029","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6029"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6029\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}