eclipselink

How to catch a runtime exception in a NB platform module?

As described here, I want to update the user's database by means of catching the exception that occurs when the entity classes don't match. I understand that I could add a catch statement to every db-interface method, but that's error-prone*. Other 'polling methods' are also possible, but they are not interrupt-driven as I want through ...

Is there any tool to validate @XmlPath annotations ?

Is there any tool to validate @XmlPath annotations used from MOXy JAXB at a specific xml file at compile time from Eclipse or IntelliJIdea java framework or something else? ...

I'd like to serialize an xml file into java objects

I have this xml file which i want to unmarchal it in a java object.I am using the MOXy JAXB library. test.xml <?xml version="1.0" encoding="UTF-8"?> <project > <type>org.netbeans.modules.ant.freeform</type> <compilation-unit> <package-root>src</package-root> <classpath mode="boot">${...

Create Null Object Unmarshalling Empty Element with JAXB

I am using JAXB (EclipseLink implementation) in a JAX-RS webservice. When an empty element is passed in the XML request an empty object is created. Is it possible to set JAXB to create a null object instead? Example XML: <RootEntity> <AttributeOne>someText</AttributeOne> <EntityOne id="objectID" /> <EntityTwo /> </RootEnt...

Validate JAXBElement in JPA/JAX-RS Web Service

I have a JAX-RS webservice (Jersey) that is a CRUD interface for JPA (EclipseLink) entities. My entities were autogenerated from the database tables and I have annotated them with JAXB annotations so that they can be marshalled/unmarshalled to/from XML. My resource methods take JAXBElement objects as a parameter where required. I don'...

EclipseLink: Checking current transaction isolation level

I have a standalone Java application that uses EclipseLink 2.0.1. It is configured by a persistence.xml, and then does something like: final EntityManagerFactory emf = Persistence.createEntityManagerFactory("xy"); final EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); .... em.getTransaction().commit(); I want...

EclipseLink @MappedSuperclass and generics.

I have a few domain model classes in my web app that have a hierarchical relationship to themselves. An example of one is the hierarchical category structure used to classify users postings. There is some logic relating to the hierarchical nature of these classes that is common. So I tried to move the logic into a generic @MappedSupercl...

JPA Mapping Issue - Modelling direction requested

Hello, I'm having a problem modelling the following problem in JPA. I have a JPA Entity class 'User', like so: (accessors/mutators/extraneous fields/extraneous JPA configuration omitted for brevity) @Entity class User { @Id @Generated Value long id; @OneToMany Report contributorReports; ...

Why the compiler doesn't recognize the metamodel attributes?

Is the criteria api of eclipselink jpa2 supported for java se 6 projects? If not, that's my problem. Do I need to specify anything special to the criteria api in the persistence.xml? This is my criteria query: final EntityType<Meaning> Meaning_ = em.getMetamodel().entity(Meaning.class); final CriteriaBuilder cb = em.getCriteriaBui...

Eclipselink entity class autoscan finds non-entities

I've activated the auto-detect mode of Eclipselink 2.0 to find @Entity annotated classes: <exclude-unlisted-classes>false</exclude-unlisted-classes> But Eclipselink tells me that I should add an ID to my Entity: Caused by: Exception [EclipseLink-7161] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence...

How can I get EclipseLink to create MySQL InnoDB tables?

It generates MyISAM tables by default. I don't want to have to get it to generate a DDL script and then edit that if I can avoid it. I would also like to avoid changing the default table type of my MySQL installation unless I can do that for online one database. Any ideas? ...

'ALTER TABLE' cannot be performed because table does not exist.

I'm using JPA 2 with Eclipselink 2 and a Derby in memory db for my tests. When I start my little test programm I get the following exception: [EL Warning]: 2010-08-12 17:17:44.943--ServerSession(948252856)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.Database...

eclipselink doesn't fetch list

Hi, there are two entity classes: @Entity public class Place implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @OneToMany(mappedBy = "place") private List<Event> events = new ArrayList<Event>(); private String name; //getters setters } @Entity public class Event implements...

JPA/Eclipselink cache life span

1.- I'm working Glassfish 2.1 with EcipseLink 2.0.0, so really using JPA 1.0 specification, and I have a stateless EJB that finds entities among other things. As far as i know JPA 1.0 defines a L1 cache that works at Persistence Context level (transaction level for stateless EJBs) but I can't figure out why the next code prints "Not same...

EclipseLink cascade persist exception

I am getting "During synchronization a new object was found through a relationship that was not marked cascade PERSIST" when attempting to persist an object Word() that has a Many-To-Many field mapping to a table Topics. The relations bridge table is Topic_links. What complicates the problem is that I always use the Eclipse Workbench to...

Use PostgreSQL Domain and Struct types in Java

After creating EntityManagerFactory instance, I receive error message: ... Exception Description: Predeployment of PersistenceUnit [aPU] failed. Internal Exception: Exception [EclipseLink-7157] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.ValidationException Exception Description: Entity cla...

JPQL / HQL fetch join syntax for compatibility with EclipseLink & Hibernate

I would like to be able to swap my JPA implementation between EclipseLink & Hibernate with a simple property change. I can do this ok but what is causing me problems is the named query validation. Using EclipseLink I have to write fetch joins like so: SELECT id FROM IndexDefinition id JOIN FETCH id.index JOIN id.index i JOIN FETCH i....

JPA update many-to-many deleting records

I have a @ManyToMany relationship between two entities. When I perform an update on the owning side, it appears that JPA deletes all the linked records from my database and re-inserts them. For me this is a problem because I have a MySQL trigger that fires before a record is deleted. Any ideas on how to get around this problem? Thanks R...

What is the best optimized way to select many entities with subentities in JPA?

Let's say we have: @Entity public class Order { @Id private int id; @OneToMany(mappedBy="order") private List<Item> items; ... } and @Entity public class Item { @Id private int id; @ManyToOne private Order order; ... } And let's say there is 10.000 orders with each having 20 items. We need to iterate thought all order...

NoViableAltException using jpa

Hi @all, i´ve got a problem to get jpa running. Following exception appears when i try to run the Login.java WicketMessage: Can't instantiate page using constructor public de.test.pages.LoginPage() Root cause: NoViableAltException(93!=[364:1: selectExpression returns [Object node] : (n= aggregateExpression | n= scalarE...