eclipselink

Eclipselink problem in a javase project

I am getting this error when I am running my eclipselink project. [EL Warning]: 2008.12.05 11:47:08.056--java.lang.NoClassDefFoundError: org/jboss/resource/adapter/jdbc/ValidConnectionChecker was thrown on attempt of PersistenceLoadProcessor to load class com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker. The class is ignore...

An alternative to Hibernate or TopLink?

Is there a viable alternative to Hibernate? Preferably something that doesn't base itself on JPA. Our problem is that we are building a complex (as in, many objects refer to each other) stateful RIA system. It seems as Hibernate is designed to be used mainly on one-off applications - JSF and the like. The problem is mainly that of lazy...

Hibernate equivalent to EclipseLink's batch query hint?

One thing I like about EclipseLink has this great thing called the batch query hint, which I'm yet to find a Hibernate equivalent of. Basically doing a whole bunch of joins gets messy real quick and you end up querying way more data than you necessarily want (remember that if you join person to 6 addresses the person information is retu...

What is the difference between TopLink Essentials & EclipseLink

What is the difference between TopLink Essentials & EclipseLink, both originates from Oracle ? ...

How To Configure Query Cacheing in EclipseLink

I have a collection of states, that I want to cache for the life of the application, preferably after it is called for the first time. I'm using EclipseLink as my persistence provider. In my EJB3 entity I have the following code: @Cache @NamedQueries({ @NamedQuery( name = "State.findAll", query = "SELECT s FROM State...

Glassfish Eclipselink join-fetch hint not working

I'm having real difficulty getting the eclipselink.join-fetch hint to work in glassfish. I have a Client object that contains a collection of Task objects and the Task object has a collection of WorkPeriod objects. My code looks like this: Query query = entityManager.createQuery("select client from Client client left join fetch client...

Is EJB inheritance through different EJB modules possible?

Is it possible to have an entity class which inherits from another (abstract) entity class from another ejb module? EclipseLink for example doesn't create the depending columns in database table of the subclass. It simply ignores the (abstract) superclass entity. ...

Why EclipseLink Query cache only works when I use query.getSingleResult()?

My entity has a named query which looks like this: @NamedQuery(name = "Person.find", query = "select p from Organization p where p.name=:NAME") In my code I want to set the query cache hint: query.setHint("eclipselink.cache-usage", "CheckCacheThenDatabase"); If I try to get whole result list: List<Person> result = query.getResultL...

Pitfalls and practical Use-Cases: Toplink, Hibernate, Eclipse Link, Ibatis ...

I worked a lot with Hibernate as my JPA implementation. In most cases it works fine! But I have also seen a lot of pitfalls: Remoting with persisted Objects is difficult, because Hibernate replaces the Java collections with its own collection implementation. So the every client must have the Hibernate .jar libraries. You have to take c...

How to use @BasicMap for a HashMap whose key values are entities

How should I use EclipseLink's @BasicMap annotation for a map whose key value is an entity and the value is an Integer? @Entity class A { // This doesn't work, as the key is an entity @BasicMap private Map<B, Integer> myMap = new HashMap<B, Integer>(); } @Entity class B { ... } ...

How do I guarantee the order of items in a collection

I have a list of objects and each and every object in the list have a position which may not change unless explicitly changed, in other words, the objects are in a queue. What collection should I use in my entity class to store these objects and how should that collection be annotated? I currently have this @Entity class Foo { ... ...

Controlling the column order when EclipseLink creates tables

I'm using EclipseLink with the "eclipselink.ddl-generation" property set to "create-tables". The order of the columns in the created tables seems random. I want the columns in a particular order - the order in which the fields appear in the Entity class definition. Is there a way to tell EclipseLink to create the columns in the order ...

How do you Set Up a Many-to-Many Relationship with Junction Table using JPA/EclipseLink

I have 2 tables: Movies: movieID Users: userID These tables have a many to many relationship through the Queue table, with an additional attribute, listOrder: Queue: movieID, userID, listOrder I'm attempting to model this using EclipseLink, but am getting an "incompattible mapping" error. Here is a sampling of my code: @...

How can I get information out of a junction table using JPA/EclipseLink?

I have the following many-to-many mapping: public class Student implements { @Id @GeneratedValue private Integer xID; @ManyToMany @JoinTable(name = "x_y", joinColumns = { @JoinColumn(name = "xID")}, inverseJoinColumns={@JoinColumn(name="yID")}) private Set<Cat> cats; } public class Cat implements { @Id ...

Why does EclipseLink think my database schema doesn't exist?

I'm working on a web project using EJB 3.0, and whenever EclipseLink tries to interact with the database, it says that the schema I'm using doesn't exist (which it does). I get a massive, unhelpful stack trace from GlassFish 2.1, which begins with: EclipseLink, version: Eclipse Persistence Services - 1.1.0.r3639-SNAPSHOT file:/C:/Docu...

With Eclipselink/JPA, can I have a Foreign Composite Key that shares a field with a Primary Composite Key?

My database has two entities; Company and Person. A Company can have many People, but a Person must have only one Company. The table structure looks as follows. COMPANY ---------- owner PK comp_id PK c_name PERSON ---------------- owner PK, FK1 personid PK comp_id FK1 p_fname p_sname It has occurred to me that I could remove PER...

How can I merge / extend persistence units from different JARs?

I use JPA persistence for my data models with Eclipselink as the persistence provider. I have a modular (OSGi) application and one of the modules contains the standard data model and a persistence unit that automatically includes all the entities from the package. The persistence provider is in another module, which works well. Now I wa...

JPA EntityManager deletes all records in database

I have one Servlet that does insertion into my database. This is working fine. A second Servlet displays what the first one has inserted, however whenever I run the displaying Servlet, all records in all my tables are being deleted! My JPA implementation is EclipseLink and the db is MySQL. Is it possible that the way I retrieve a Entity...

In an OSGi environment, how are the classpaths and classloaders set up?

I'm confused about class visibility in OSGi. I'm running Apache Felix and loading the following bundles: the antlr, asm, jpa and core bundles from eclipselink an OSGi-fied jar for javax.persistence 1.99 an OSGi-fied jar with the com.mysql.jdbc driver a bundle of my own that contains annotated entity classes and a persistence.xml anothe...

Indirectly generate sequence numbers for composite primary keys with JPA

I have a JPA entity class with a composite primary key (uid,lid) that in the database should look like this; UID | LID | ... --------------- 1 | 1 | ... 1 | 2 | ... 1 | 3 | ... 2 | 1 | ... 2 | 2 | ... 2 | 3 | ... How can I make EclipseLink/JPA generate sequence numbers on the fly, or how can I find out the high...