jpa-2.0

JPA CascadeType.ALL does not delete orphans.

I am having trouble deleting orphan nodes using JPA with the following mapping @OneToMany (cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "owner") private List<Bikes> bikes; I am having the issue of the orphaned roles hanging around the database. I can use the @org.hibernate.annotations.Cascade Hibernate specific tag ...

PostGIS and JPA 2.0

Hi *, I like to map datatypes from PostGIS with JPA 2.0. I googled for solutions or examples, but all I can find is, that JPA does not support mapping of custom data types. Is it still in JPA 2.0? Has anybody a hint for an example? Thanks & regards Patrick ...

A concise, clear list of what is new in JPA2?

Does anybody know of a good list of what is new in JPA 2? Not what is new with Hibernate/TopLink in the version that supports JPA 2 but what is new in the actual spec. ...

JPA 2.0 Eclipse Link ... Composite primary keys

I have two entities(actually more but it doenst matter) Exam and Exam_Normals Its a oneToMany relationship... The problem is that i need a primary key for Exams_Normals PK (Exam_ID Item) Item should be 1 2 3 4 5 etc.... But cant achieve it getting errors An alternative would be to: I cound use an IDENTITY and a ManyToOne relationship ...

How to persist an entity which contains a field of user type using JPA2

I'm looking for a way to persist an entity which contains a field of a user type. In this particular example I would like to persist the ts field as number of milliseconds. import org.joda.time.DateTime; @Entity public class Foo { @Id private Long id; private DateTime ts; } ...

Dynamic JPA 2.0 query using Criteria API

Hello all, I am a bit stucked constructing a dynamic query using the CriteriaBuilder of JPA 2.0. I have quite a common use case I guess: User supplies a arbitrary amount of search parameters X to be and / or concatenated: like : select e from Foo where (name = X1 or name = X2 .. or name = Xn ) The Method or of CriteriaBuilder is no...

Does Hibernate 3.5.0-CR-2 release support JPA2.0

I see that Hibernate home page has a symbol informing that it implements JSR 317, but I couldn't find if it implements the full spec. Does anybody knows if Hibernate 3.5.0-CR-2 fully implements the JSR 317? I can see from their JIRA that everything is closed related to JPA 2.0: http://opensource.atlassian.com/projects/hibernate/browse/...

Hibernate 3.5-Final in JBoss 5.1.0.GA

Hibernate 3.5-Final is finally here and it offers the much anticipated JPA2 support, amongst other features. I am working on a project(EJB3 based) using JBoss 5.1.0.GA and Hibernate 3.3, but I wanted to take advantage of the JPA2 and tried to upgrade to Hibernate 3.5. What I did was fairly simple and standard - I just put all the hibern...

ManyToMany Relation does not create the primary key

Hello, I have a ManyToMany relationship between two classes: ClassA and ClassB, but when the table for this relationship (table called objectA_objectB) there is no primary key on it. In my ClassA I have the following: @ManyToMany(fetch=FetchType.LAZY) @OrderBy(value="name") @JoinTable(name="objectA_objectB", joinColumns= ...

Creating queries using Criteria API (JPA 2.0)

Hello there ! I'm trying to create a query with the Criteria API from JPA 2.0, but I can't make it work. The problem is with the "between" conditional method. I read some documentation to know how I have to do it, but since I'm discovering JPA, I don't understand why it does not work. First, I can't see "creationDate" which should app...

Hibernate schema parameter doesn't work in @SequenceGenerator annotation

I have the following code: @Entity @Table(name = "my_table", schema = "my_schema") @SequenceGenerator(name = "my_table_id_seq", sequenceName = "my_table_id_seq", schema = "my_schema") public class MyClass { @Id @GeneratedValue(generator = "my_table_id_seq", strategy = GenerationType.SEQUE...

JPA 2.0 EclipseLink Check for unique

Hello... I have a collumn as unique=true.. in Exam class.... I found that because transactions are commited automaticaly so to force the commit i use em.commit() However i would like to know how to check if it is unique.Running a query isnt a solution because it may be an instert after checking because of the concurency.... Which is ...

Why does Hibernate ignore the JPA2 standardized properties in my persistence.xml?

I have an extremely simple web application running in Tomcat using Spring 3.0.2, Hibernate 3.5.1, JPA 2, and Derby. I am defining all of my database connectivity in persistence.xml and merely using Spring for dependency injection. I am using embedded Derby as my database. Everything works correctly when I define the driver and url pro...

JPA 2.0, hiberante 3.5, jars & persistence.xml location

I'm building a desktop application using hibernate 3.5 & JPA 2.0. I have 2 jars, the lib, which defines every entity and DAO, packages looks like this : org.my.package.models org.my.package.models.dao org.my.package.models.utils In org.my.package.utils I defined my hibernate utility class for getting EM & EMF instances, which mean...

Is this possible: JPA/Hibernate query with list property in result ?

In hibernate I want to run this JPQL / HQL query: select new org.test.userDTO( u.id, u.name, u.securityRoles) FROM User u WHERE u.name = :name userDTO class: public class UserDTO { private Integer id; private String name; private List<SecurityRole> securityRoles; public UserDTO(Integer id, String name, List<SecurityRole>...

Hibernate JPA 2.0 CriteriaQuery, subset listing and counting at once

I want to build a method that can both retrieve a count(*) and select * from a criteria query. Using the hibernate criteria API I could easily do this using criteria.setProjection(Projections.rowCount()); , but I recently started using the JPA2.0 Criteria API and am uncertain how to obtain a similar result. Below is a little code frag...

JPA 2 and Hibernate 3.5.1 MEMBER OF query doesnt work.

I'm trying the following JPQL and it fails misserably: Query query = em.createQuery("SELECT u FROM User u WHERE 'admin' MEMBER OF u.roles"); List users = query.query.getResultList(); I get the following exception: ERROR [main] PARSER.error(454) | <AST>:0:0: unexpected end of subtree java.lang.IllegalArgumentException: org.hibernate....

Can't get JPA2 running with Hibernate and Maven

Have been trying the whole day long and googled the ** out of the web ... in vain. You are my last hope: Here's my code: The Entity: package sas.test.model; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class Employee { @Id private int id; private String name; private long salary; publi...

Execute sql script after jpa/EclipseLink created tables?

Hello, is there a possibility to execute an sql script, after EclipseLink generated the ddl? In other words, is it possible that the EclipseLink property "eclipselink.ddl-generation" with "drop-and-create-tables" is used and EclipseLink executes another sql-file (to insert some data into some tables just created) after creating the ta...

JPA 2.0 Eclipse Link

I have this code @Column(updatable=false) @Enumerated(EnumType.STRING) private ExamType examType; However, I can still change the value when I update it via merge. Why? ...