eclipselink

Maven and the " is not a known entity type" error

Hi everybody, I generated a maven project with the quickstart archetype. So I obtained the following project structure: |-- src | |-- main | | |-- java | | |-- resources | |-- test | | |-- java | | |-- resources |-- pom.xml I modified the "pom.xml" file : <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:...

How to use JPA EclipseLink to connect to the DB in a multi layer environment (REST + EJB + Core) ?

I am using Glassfish v3 server. Usually the DB connection with EJB3 + JPA (Eclipselink) is done through injection, with @PersistenceUnit or @Persistencecontext. However, there are 3 layers in my App : Core (contains business logic, entities, exception handling etc) an EJB on top of it, calling the right core objects and methods to do...

How to create the metamodel for multiple persistence units using the same entity classes?

I get: diagnostic error: javax.annotation.processing.FilerException: Attempt to recreate a file for type for: <compilerArguments>-Aeclipselink.persistencexml=src/main/resources/META-INF/persistence.xml -Aeclipselink.persistenceunits=com.mysimpatico_MemoPlatform-database_nbm_1.0-SNAPSHOTPU,com.mysimpatico...

make a entity class rows read-only in JPA

I m able to get values using JPA when i have only mapped one table Now when i have gone for mapping related tables i get the error Only one may be defined as writable, all others must be specified read-only. Mapping: org.eclipse.persistence.mappings.OneToOneMapping[userId1] I m using [EclipseLink-0] (Eclipse Persistence Services...

Netbeans code for Postgresql and Eclipselink - identifying relation question

I have the following database tables: party, with a pk "pty_id" connected to a sequence for generating pk values. person with a fpk "prs_pty_id" in an identifying relation to party.pty_id. company ... which is not involved at the moment, but obviously this is kindof sub-superclass setup, and it could probably have been implemented with...

Problems with generating sql via eclipseLink - missing separator

hi folks, i'am using eclipseLink with jpa. in my persistence.xml, i defined to generate a create.sql file. the file will be generated, but with missing ';'-separators for each sql statement. is there a possibility to define a separator in the persistence.xml or in some other way? regards bva Example persistence.xml: <provider>o...

Is there an EclipseLink equivalent of "hibernate.query.startup_check"?

I am using annotational entity configuration with EclipseLink/JPA and need to disable named query validation upon startup. Is there an EclipseLink equivalent property to: hibernate.query.startup_check=false ...

java.sql.SQLException: Table/View 'SEQUENCE' already exists in Schema 'ADMIN'.

My application throws this Exception. I am using Java DB as the back end and i am using JPA Internal Exception: java.sql.SQLException: Table/View 'POCKETMONEY' already exists in Schema 'APP'. Error Code: 30000 Call: CREATE TABLE APP.POCKETMONEY (ID INTEGER NOT NULL, DateofSpending DATE, DESCRIPTION VARCHAR(255), AMOUNT IN...

CriteriaBuilder JPA 2.0 Eclipselink

If I want something like that with EclipseLink and JPA 2.0 SELECT ... FROM ... WHERE name1=value1 AND name2=value2 OR name3=value3 Which is the best way?? In the oficial say somthing like: cq.where(cb.equal(pet.get(Pet_.name), "Fido") .and(cb.equal(pet.get(Pet_.color), "brown"); http://download.oracle.com/javaee/6/tutorial/doc/...

JPA best practice question - Updating one field only

My question is similar to http://stackoverflow.com/questions/3476613/updating-one-field-in-jpa-entity Basically I have an entity Foo which has some basic fields (enum, String, DateTime) and it has two other fields. One of them is a OneToOne and the other is a OneToMany implemented using a Collection. I have two threads which are run...

How to re-attach an object to EclipseLink session after deserialization

Here's a simple POC: public void main(String[] args) { final String FILE_NAME = "c:/poc.ser"; try { HotelJdo hotel = HotelJdoFinder.findById(430); ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(FILE_NAME)); // serialize the object oos.writeObject(hotel); oos.close(); ...

ManyToMany JPA fetch

Hi I have a problem fetching the skills from the volunteer. for some reason i dont get the list when using this method public Volunteer getVolunteer(int id){ Volunteer vo; Query q; q = em.createNamedQuery("Volunteer.findById").setParameter("id", id); vo = (Volunteer) q.getSingleResult(); for(Skill s: vo.getSkills()){ System.o...

Why does not jpa2/eclipselink generate on delete cascade SQL?

@Entity public class MUser implements Serializable, MemoEntity { private static final long serialVersionUID = 1L; @Id private String email; @OneToMany(cascade=CascadeType.ALL, orphanRemoval=true) private Set<Meaning> mengs = new HashSet<Meaning>(); Shouldn't this mean that I get the constraint with a "on delete cascade"? This is wha...

What's an appropriate DAO structure with jpa2/eclipselink?

I've JPA entities and need to perform logic with them. Until now a huge static database class did the job. It's ugly because every public interface method had an private equivalent that used the EntityManager, to perform transactions. But I could solve that having a static em too! However i'm wondering if that's an appropriate design, es...

Why does eclipselink/jpa attempt to persist an entity while I don't ask it to?

I'm trying to persist 3 entities (exp,def,meng) in a transaction, and then persist another 2 (def', meng'), where meng' is related to exp. However, as I attempt to persist meng' eclipselink/jpa2 is being told to: Call: INSERT INTO EXPRESSION (EXPRESSION, GENDER) VALUES (?, ?) bind => [exp, null] which will throw an expession sinc...

Where did the EclipseLink/Maven repository go to?

The link quoted on the EclipseLink/Maven wiki ends on an Error 403 page on switch.ch. If you are redirected to a better mirror then that would already be the answer. If not: where did the repository go to? Searching the net only reveals that EclipseLink/Maven hat a history of typos on there Wiki-Page. However all the corrected links I f...

jpa find problem

hi the find method does not return the latest version of an object. somewhere in my code I find an object, change it, merge it and commit my changes. In the database the changes are made but in another function I find this object and my changes are not there. I've checked race-conditions with the result that there are no race-conditions....

JPA: JOIN in JPQL

I thought I know how to JOIN in JPQL but apparently not. Can anyone help me? select b.fname, b.lname from Users b JOIN Groups c where c.groupName = :groupName This give me Exception org.eclipse.persistence.exceptions.JPQLException Exception Description: Syntax error parsing the query Internal Exception: org.eclipse.persistence.intern...

No operator matches the given name and argument type(s). You might need to add explicit type casts. -- Netbeans, Postgresql 8.4 and Glassfish

I am trying to edit a table in Postgresql using JPA in Glassfish using EclipseLink. When I insert an entity, it runs fine. But, when I try to edit or remove the same entity, it fails with the following error. Any idea? Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistenc...

why testing an individual junit test works, while testing them together won't?

The test that fails when tested together with mvn test (or through the ide) is called EmpiricalTest. If I test the file alone it goes through, but not otherwise. Why could that be? You can checkout the Maven source code (to test) from here. This is how I make sure the database is 'blank' before each test: abstract public class Persis...