eclipselink

JPA ManyToMany problem...

Hello i have an Entity Exam @Id @GeneratedValue(strategy=GenerationType.TABLE) private Long id; ..... ...... @ManyToMany private List<Exam> exams; @ManyToMany(mappedBy="id") private List<Exam> parentExams; The problem is that @ManyToMany private List<Exam> exams; is ok works great... but...

EclipseLink: onetomany relationships with lazy loading loaded with serialization

Hello, I'm facing a problem with eclipselink under websphere 7.0 in a clustered environment. When my entity is serialized every 1-n relationship lazy is loaded, even if the entity is detached. How can I avoid this behavior, without having to use DTO? Thank you very much ...

Ability to switch Persistence Unit dynamically within the application (JPA)

My application data access layer is built using Spring and EclipseLink and I am currently trying to implement the following feature - Ability to switch the current/active persistence unit dynamically for a user. I tried various options and finally ended up doing the following. In the persistence.xml, declare multiple PUs. Create a clas...

How to handle "null primary key encountered" exception in eclipselink?

Hi. I'm catching ... Null primary key encountered in unit of work clone ... exception in eclipselink(2.0.2 with 2.0 jpa) literally meaning that id in my entity is <=0 (for primitive types). Though debug here states that everything's fine and I have nothing to worry about. My AS is glassfish v3. Can any one point out what may cause suc...

Unable to acquire a connection from driver [null], user [null] and URL [null]. / EclipseLink 1.2 / Spring 2.5.6 / OSGI

Hi, I try to deploy a project where EclipseLink JPA is used as ORM tool on an OSGI platform. The project works fine when running outside of a OSGI container. Version used : Spring 2.5.6, EclipseLink 1.2.0 Unfortunately, I get this error on the OSGI platform : Exception Description: Unable to acquire a connection from driver [null], u...

Can I and should I use Eclipselink for non OR database interactions?

We are using Eclipselink for ORM, but we have a need for some more lightweight database interactions that are more equivalent to JDBC. My question is whether Eclipselink supports such an idiom and whether there are any advantages of it to straight JDBC. I can see one advantage being consistency and being able to use the existing connecti...

[JPA] How to handle many-to-many link tables with additional columns

Assume the following exemplary DB-Design: USERS ----------------- ID NAME ROLES ----------------- ID NAME USERS_ROLES ----------------- FK_USER_ID FK_ROLE_ID LOGIN PASSWD I map this relation with eclipse-link using xml. The users: <many-to-many name="roles" mapped-by="users"> <join-table name="USERS_ROLES"> <join-column nam...

JPQL cross tab query

Hi can anyone tell me if its possible to write a cross tab query in JPQL? (I'm using eclipse link JPA2) An example of a cross tab query in SQL can found here http://onlamp.com/pub/a/onlamp/2003/12/04/crosstabs.html SELECT dept, COUNT(CASE WHEN gender = 'm' THEN id ELSE NULL END) AS m, COUNT(CASE WHEN gender = 'f' THEN id ...

Forcing a method to be non-transactional in JPA (Eclipselink)

Hi, I am developing an application using Eclipselink and as part of the app I need to be able to manipulate some of the objects which involves changing data without it being persisted to the database (i merging/changing objects for some batch generation processes). I am reluctant to change the data in the Entity objects, as there is a...

Disable caching in JPA (eclipselink)

Hi, I want to use JPA (eclipselink) to get data from my database. The database is changed by a number of other sources and I therefore want to go back to the database for every find I execute. I have read a number of posts on disabling the cache but this does not seem to be working. Any ideas? I am trying to execute the following code:...

How do I write JPA QL statements that hints to the runtime to use the DEFAULT value ?

I have a table like so: mysql> show create table foo; CREATE TABLE foo ( network bigint NOT NULL, activeDate datetime NULL default '0000-00-00 00:00:00', ... ) In the domain object, FooVO the activeDate member is annotated as Temporal. If I don't set activeDate to a valid Date instance, a new record is inserted with NULLs....

JPA Inheritance and Relations - Clarification question

Here the scenario: I have a unidirectional 1:N Relation from Person Entity to Address Entity. And a bidirectional 1:N Relation from User Entity to Vehicle Entity. Here is the Address class: @Entity public class Address implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = Gene...

Mysql maven jpa skeleton

Hi, is there a skeleton for a project using mysql, some eclipse/top link with RESOURCE_LOCAL as connection type? Preferably using maven. I'm searching for it for hours and can't get running even the sipmlest exaple. So if you had it ready and running, please, post :-). Even something as simple as these two classes only. @Entity public c...

Catching constraint violations in JPA 2.0.

Consider the following entity class, used with, for example, EclipseLink 2.0.2 - where the link attribute is not the primary key, but unique nontheless. @Entity public class Profile { @Id private Long id; @Column(unique = true) private String link; // Some more attributes and getter and setter methods } When I insert re...

Match entities fulfilling filter (strict superset of search)

I have an entity (let's say Person) with a set of arbitrary attributes with a known subset of values. I need to search for all of these entities that match all my filter conditions. That is, given a set of Attributes A, I need to find all people that have a set of Attributes that are a superset of A. For example, my table structures loo...

Need help in setting application name with JPA (EclipseLink)

hello everybody i am using JPA with EclipseLink and oracle as DB and i need to set the property v$session of jdbc4 it allows to set an identification name to the application for auditing purposes but i had no lucky setting it up....i have been trying through entitiyManager following the example in this page: http://wiki.eclipse.org/Conf...

eclipselink cache

do i have to use elipselink as a persistence provider to make eclipselink cache working, please advise ...

Persist data when the table was not mapped (JPA EclipseLink)

I need some help in persisting data into a table that has not been mapped. Our database has a table in which all of its columns are foreign keys so by mapping the whole database all of the tables are correctly mapped. However that table called "category" is not mapped. We browse the data by passing for the table I mentioned using the...

Disable eclipselink caching and query caching - not working?

I am using eclipselink JPA with a database which is also being updated externally to my application. For that reason there are tables I want to query every few seconds. I can't get this to work even when I try to disable the cache and query cache. For example: EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerF...

HQL to JPQL question

What is the translation of the following HQL query to EclipseLink compliant JPQL : select p from NameList list, Person p where p.name in elements(list.names) (this is just a variation of a HQL example query taken from here) In EclipseLink the IN function doesn't seem to take property paths : Internal Exception: NoViableAltException(...