eclipselink

Indexed element access in JPQL

Is it possible to do indexed element access in JPQL like in HQL : select o from Order o where o.items[0].id = 1234 I couldn't find something related in the JPA 2 specs, I am targeting EclipseLink JPA here, so if you come up with an EclipseLink solution, that's ok as well, although a JPQL standard solution is preferred. ...

JPA - Setting entity class property from calculated column?

I'm just getting to grips with JPA in a simple Java web app running on Glassfish 3 (Persistence provider is EclipseLink). So far, I'm really liking it (bugs in netbeans/glassfish interaction aside) but there's a thing that I want to be able to do that I'm not sure how to do. I've got an entity class (Article) that's mapped to a database...

Casts in JPQL with EclipseLink

Is it possible to use casts in JPQL? In HQL it seems to be supported cast(... as ...), where the second argument is the name of a Hibernate type, and extract(... from ...) if ANSI cast() and extract() is supported by the underlying database source : Hibernate reference My target JPA provider is EclipseLink, so any EclipseL...

How to add javadoc for ecpliselink 1.x

As It appears in the image, I cannot add the javadoc for eclipselink 1.1.x that already bundled with eclipse. So, Is there any workaround? ...

Eclipselink update existing tables

Maybe I got it wrong but i though that JPA was able to update an existing table (model changed adding a column) but is not working in my case. I can see in the logs eclipselink attempting to create it but failing because it already exists. Instead of trying an update to add the column it keeps going. <property name="javax.persistence.j...

Persisting a Many to Many Relation in JPA

We Want to persist a many to many table with EclipseLink, we have just tried by setting the collections and persist but it returns error cause it seems that is requesting for all of the collections in the hierarchy, we are doing this cause the system did not mapped that table cause it has all of its fields as foreign keys so instead of ...

Java/JAXB: Unmarshall Xml to specific subclass based on an attribute

Is it possible to use JAXB to unmarshall xml to a specific Java class based on an attribute of the xml? <shapes> <shape type="square" points="4" square-specific-attribute="foo" /> <shape type="triangle" points="3" triangle-specific-attribute="bar" /> </shapes> I would like to have a List of Shape objects containing a triangle and ...

Invoking a PL/SQL function from EclipseLink

I'm trying to execute a PL/SQL function in EclipseLink which uses Oracle Specific types(eg. Boolean). I've tried using PLSQLStoredProcedureCall which complains that I'm not executing a procedure and I have tried using StoredFunctionCall but that returns PLS-00382: expression is of wrong type Has anyone developed a solution to invoke ...

JPA EclipseLink Auditing for Oracle issue with SessionCustomizer...

I was trying to use the SessionCustomizer for auditing with v$session.program for oracle and it works with JDBC but i need it working with JPA, so i read a bit more the documentation for SESSION_CUSTOMIZER in this site: http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_(ELUG)#EclipseLink_JPA_Persistence_Unit_Properties_for_Customi...

How to setup Eclipselink with JPA?

The Eclipselink documentation says that I need the following entries in my pom.xml to get it with Maven: <dependencies> <dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>eclipselink</artifactId> <version>2.0.0</version> <scope>compile</scope> ... </dependency> <dependencies> ... <reposi...

Auditing for Oracle with EclipseLink JPA

I am using EclipseLink and i have to audit in oracle so I can audit using pure JDBC with the V$session and i can audit the application name in oracle in this way but here in EclipseLink JPA I cannot set the application name to be audited, the way in which I have been trying is by setting dynamically the session param I want using the Ses...

Can a List<> be casted to a DataModel

I'm trying to do the following: public String createByMarcas() { items = (DataModel) ejbFacade.findByMarcas(current.getIdMarca().getId()); updateCurrentItem(); return "List"; } public List<Modelos> findByMarcas(int idMarca){ return em.createQuery("SELECT id, descripcion FROM Modelos WHERE id_marca ="+idMarca+"").getResu...

EJB failure to update datamodel

Here my EJB @Entity @Table(name = "modelos") @NamedQueries({ @NamedQuery(name = "Modelos.findAll", query = "SELECT m FROM Modelos m"), @NamedQuery(name = "Modelos.findById", query = "SELECT m FROM Modelos m WHERE m.id = :id"), @NamedQuery(name = "Modelos.findByDescripcion", query = "SELECT m FROM Modelos m WHERE m.descripcio...

Jsf validation error (shown by h:message) while updating Model, why?

List.xhtml: <h:selectOneMenu value="#{produtosController.selected.codigo}"> <f:selectItems value="#{produtosController.itemsAvailableSelectOne}"/> </h:selectOneMenu> <h:commandButton action="#{produtosController.createByCodigos}" value="Buscar" /> Controller Class method: public String createByCodigos(){ items = new Lis...

Using EclipseLink

I am still new to Java and Eclipse and I'm trying to get my application to connect to a database. I think I want to use EclipseLink, but all of the documentation on the matter assumes you already know everything there is to know about everything. I keep getting linked back to this tutorial: http://www.vogella.de/articles/JavaPersistence...

JPA/EclipseLink Returning No Results

I am new to Java and JPA. I am trying to connect to a database and return some results from a table, but when I run the query, I get an empty list as a result even though the table has over 100,000 rows. Here is my persistence.xml: <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:...

EclipseLink Document Doesn't Explain "session"

I am trying to execute a query using EclipseLink following the crappy documentation at http://wiki.eclipse.org/Introduction_to_EclipseLink_Expressions_%28ELUG%29, but every time you need to execute an Expression it uses a variable called "session", but no where does it explain where this "session" variable comes from. I already have a pe...

how to use jpa outside of a web project

I've used eclipselink in a web project in netbeans. Works nice and easy. How can I do the same in a project unrelated to web(console app)? In my web app I have: @PersistenceUnit EntityManagerFactory enf; Which instantiates enf. This does not work in A console app. ...

A Flush() problem after Merging an Entity

My problem is that I have an object A which contains a list of B Objects @Entity class A { @OneToMany(cascade={CascadeType.MERGE}) List<B> list; } When I make a "merge" of an object A and then call "flush" inside a stateless EJB method em.merge(a); //a is of class A em.flush(); //doesn't flush "list" it actually doesn't wor...

Can't find the "org.eclipse.persistence" Maven dependency

I installed Eclipse Helios with the m2eclipse maven plugin. I want to create an application using JPA. So, what I do is: New > Maven Project then I select the maven default archetype. The problem is that I want to add the "org.eclipse.persistence" dependency that I can't find. Where is it? Can we add it manually? Should I update a sort...