Insertable object in a class with @IdClass annotation

Is it possible to do a cascade save in Section.class? I create Section object and add new questions without id. When I try save it I get error: org.postgresql.util.PSQLException: ERROR: insert or update on table "question_to_section" violates fo

jpa many-to-one association creating a duplicate update

i have the following meetings table package ng.telecomroadmap.model; import; import javax.persistence.*; import java.util.Date; import java.util.List; /** * The persistent class for the meetings database table. * */ @Entity @Tabl

precision and scale in @column

Here I read that length in @column is only for generated DDL. Is this true for precision and scale? @Column(precision = 15, scale = 5) private Integer myField; If so: How to define precision and scale for JPA-validation?The JPA javadocs and spec (lin

how to implement validation for name and year of birth

I have the jsp page with html form which has two textfields for a name, year of birth and a search button, for searching a user/s. A user has the option to search by entering both name and year of birth or by name or by year of birth, which means he

RunTimeException What is the cause?

I try to build this jpa project but running into the same error. I updated, changed everything still nothing. What am I missing? I only use EclipseLink (JPA 2.0) in the libaries. NetBeans IDE 7.2. An annotation processor threw an uncaught exception.

call to the primitive JPA method throws WrongClassException

public static UserDetail UserDetail.findUserDetail(Long id) { if (id == null) return null; return entityManager().find(UserDetail.class, id); } We are using spring Roo. Above is Roo generated finder method. Partial stack trace is as follows: Caused b

Generation of Eclipselink 2.5 Metamodel using Maven

I would like to know how to generate static metamodels using Maven and Eclipselink 2.5. It worked fine by adding this lines to pom.xml when running Eclipselink 2.4. // Generate meta model for eclipselink 2.4 (does not work for 2.5) <plugin> <grou

Hibernate Nested Query Using Criteria

Is it posible to create a criteria for generating below sql: select name from (select distinct name from person) as aliasname order by lower(name); here there are two sql - select distinct name from person select name from <output of 1> as aliasname

JPA EntityManager and JavaFx

This question already has an answer here: Can't create a EntityManager in JavaFx 1 answer I tried to use EntityManager in a JavaFx application in NetBeans (my solution is connected to postgres), I proceeded as follows : 1) I created a Persistence Uni

Can we use JPA2 annotations to cache associations?

I'm now using the JPA2 @Cacheable annotation on my Entities, and all is working well. I now need to cache a ManyToOne association. In classic Hibernate, it was necessary to annotate the association with @Cache. @org.hibernate.annotations.Cache(usage=

Join two tables on a third in a single model Hibernate Spring

I have two tables that I would like to treat as a single model class in Hibernate/Spring, however their only relationship can be established through a third table. For example... tableA { id integer <PK> username varchar2(25 byte) } tableB { personI

How to add JPA to the existing eclipse project?

I have an existing eclipse project (JAVA application), now I created a table in xampp - phpMyAdmin. In the project I need to implement all the queries and database in two ways: 1) JDBC 2) JPA and to choose one of them using the Spring mechanism. So I

JPA entity to SQL

mI've this entity class: @Entity public class User implements Serializable { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long id; @ManyToOne private User myFriend; @OneToMany(mappedBy="friend") private Collection<User> friend

@OneToMany size limit of the mapping list

Is there any way to limit the list's size of the @OneToMany relationship in JPA? Here's my code sample: @OneToMany(mappedBy = "publication", cascade=CascadeType.PERSIST) private List<Comment> commentList; I'm using EclipseLink 2.3 JPA impl

Fight against LazyInitializationException without the spring

I'm using Hibernate and have a problem with LazyInitializationException in my app. This problem can be simply solved by Spring framework(some annotations,config or something) but I just dont know this framework and dont want to learn it now(I'm just

Should I leave JPA or the cascading database of deletions?

Let's say we have two entities, A and B. B has a many-to-one relationship to A like follows: @Entity public class A { @OneToMany(mappedBy="a_id") private List<B> children; } @Entity public class B { private String data; } Now, I want to de

JPA how to remove parents without removing children?

I'm trying to remove a parent, but I keep getting a Foreign Key violation. If I put Cascade.ALL in the parent, it delete the children too. And it's now what I want. I have my parent class : Docteur //bi-directional many-to-one association to Patient

JPA discriminator column problem

Hallo all. I have this set of classes: @Entity @Table(name = "S_MC_CC_RAPPORTI") @Inheritance(strategy=InheritanceType.JOINED) @DiscriminatorColumn(name="COD_TIPORAPPORTO", discriminatorType=DiscriminatorType.CHAR, length=1) public abs

JPA - How to truncate tables between unit tests

I want to cleanup the database after every test case without rolling back the transaction. I have tried DBUnit's DatabaseOperation.DELETE_ALL, but it does not work if a deletion violates a foreign key constraint. I know that I can disable foreign key

JPA or Hibernate with Oracle table partitions?

I need to use an Entity framework with my application, and I have used table - partitions in Oracle database. With simple JDBC, I am able to select data from a specific partition. But I don't know whether I can do the same with hibernate or Eclipse l

Memory leak with paged JPA requests under JBoss AS 5.1

I'm trying to integrate Hibernate Search into one of the projects I'm currently working on. The first step in such an endeavour is fairly simply - index all the existing entities with Hibernate Search(which uses Lucene under the hood). Many of the ta

JPA Registration in WebLogic 11g (10.3.1)

How do you enable debug logging for OpenJPA when running an application in WebLogic 11g? I tried the steps given by Logging JPA SQL with Weblogic 10.3, but no OpenJPA log statements appear in the server log. I have also poured over the WebLogic docum

Is there a way to change the type of JPA retrieval on a method?

Is there a way to change the JPA fetch type on a single method without editing the entity object? I have a shared ORM layer consisting of JPA entity classes. This ORM layer is accessed by two DAO layers. One DAO needs lazy fetching, as it is for my w