openjpa

Using enum as id

Using JPA, can we define an enum as id of an entity? I've tried the following: public enum AssetType { .... } @Entity @IdClass(AssetType.class) public class Adkeys { private AssetType type; @Id @Enumerated(EnumType.STRING) @Column(nullable = false) public AssetType getType() { return type; } } Using Ope...

Persisting deep object graph with JPA without em.flush()

I have following model: Report, ReportSection and ReportSectionProperty. Report has zero to many ReportSections, ReportSection has zero to many ReportSectionPropert-ies. This would qualifie as three levels deep object graph. I create new Report, then add some sections to it, then add some properties to it. When I try to persist Report...

JPA / OpenJPA NULL on primary key.

Problem with OpenJPA. It returns null values on primary key. I debug the open jpa code and i can't find the reason why it returns null on the primary key. I start debugging and the openjpa finds the entry with all data an a value at the primary key but at some point in the code it changes the object and the primary key is gone This is m...

How to generate ORM.XML mapping files from annotations?

At work, we design solutions for rather big entities in the financial services area, and we prefer to have our deployment mappings in XML, since it's easy to change without having to recompile. We would like to do our development using annotations and generate from them the orm.xml mapping files. I found this proof of concept annotation...

jpa update for objects having comosite primary key

I have a composite primary key for my object.How can i use a jpa to update my object? Normally we use the following code EntityManagerFactory emf = Persistence.createEntityManagerFactory("jpa"); EntityManager em = emf.createEntityManager(); Student stud1 = em.find(Student.class,1); stud1.setSname("Deepak"); //set others em.merge(stud1)...

can OptimisticLockException occur if app srv Isolation level is set to READ COMMITTED?

I am using Websphere application server 7.0.0.0.9 with ;OpenJPA 1.2.3-SNAPSHOT'. I have Set property of jdbc data source webSphereDefaultIsolationLevel=2 (READ COMMITTED). I have this question because My understanding is the OptimasticLockException occurs if there is race to commit the same row by multiple thread. But I think this sit...

Autocommit OpenJPA writes

I'm using OpenJPA and want to configure it to use Autocommit on every write/insert operation. At the moment I have to do this: MyEntity e = new MyEntity(); em.getTransaction().begin(); em.persist(e); em.getTransaction().commit(); What I want to be able to do is this: MyEntity e = new MyEntity(); ...

Apache Wicket, OpenJPA and Spring/ROO

I've set up a Spring ROO application, set persistence to OpenJPA and created some entities. Then I replaced Spring MVC with Apache Wicket. Stuff seems to be working fine and I've successfully displayed a list of Customer entities. Next up was the editing view for the customer. For now I've made a Wicket form that uses the OpenJPA entity...

problem with using JPA

I am getting following exception while i try to execute simple jpa code. What may be the casue? 5453 DevPQRWDPBSSPersist WARN [P=351601:O=0:CT] openjpa.Enhance - This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "[class com.XYZ.PQ...

Remove Table Column from an Ant task - OpenJpa

It is said that with the use of org.apache.openjpa.jdbc.ant.MappingToolTask it is possible to synchronize domain models classes with db schema. So by having following script as an Ant task i was able to add new columns to the given databases on the persistance.xml. <target> <taskdef name="mappingtool" classpathref="maven.compile.cla...

JPA: default column name mapping for @ManyToOne relations

When we have a class: @Entity Order implements Serializable { @Id private Integer id; ... } and: @Entity OrderLine implements Serializable { @Id private Integer id; @ManyToOne Order order; ... } What row name will the property order map to? order_id, ORDER_ID or Order_id? (ommiting the @JoinColumn...

problem with JPA entity

I am using JPA (OpenJPA). I have following entries in my persistence.xml: <property name="openjpa.RuntimeUnenhancedClasses" value="supported"/> I also have Serviceoffering class listed in perisitence.xml. I am getting following exception when I try to run my jpa related code. What can be the problem? No metadata was found for type "c...