persistence-unit

JPA default persistence unit

I get exception "There is no default persistence unit in this deployment." can I somehow mark unit as default?(I have only one persistence unit, so Id rather not call it by name) ...

How to execute differnet import.sql in Hibernate/JPA for each persistence unit?

I have configured two persistence units in my JPA/Hibernate configuration. Now i need to execute different import.sql for each persistence unit. How can I specify which import.sql should be executed for each persistence unit? According Hibernate to documentation, I should place import.sql in classpath. If I do that, import.sql is execute...

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...

use of EntityManagerFactory causing duplicate primary key exceptions

Hey guys, my goal is create an EntityManager using properties dependent on which database is in use. I've seen something like this done in all my Google searches(I made the code more basic for the purpose of this question): @PersistenceUnit private EntityManagerFactory emf; private EntityManager em; private Properties props; @PostCon...

EJB3 - using 2 persistence units within a transaction (Exception: Local transaction already has 1 non-XA Resource)

I am trying to use 2 persistence units within the same transaction in a JEE application deployed on Glassfish. The 2 persistence units are defined in persistence.xml, as follows: <persistence-unit name="BeachWater"> <jta-data-source>jdbc/BeachWater</jta-data-source> ... <persistence-unit name="LIMS"> <jta-data-source>jdbc/BeachWaterLIM...

Seam - Multiple Persistence Units

Hi all, Does Seam support multiple persistence units in its configuration? Also, when would you want to have or need multiple persistence units? I am working on a generic component and right now, it only supports a single persistence unit which makes sense to me as I have never used more than 1 persistence unit per web application. S...

How to bind an entity to a specific persistence-unit

In a web application using struts2 ejb hibernate, is it possible to tell the application to find or create an entity for a specific persistence-unit name, which is written in persistence.xml file, in the deployment time? I have two persistence-unit in persistence.xml, and one datasource (including two "local-tx-datasource") xml file un...

Is it possible to share configuration from persistence.xml?

I have one persistence unit configured in my persistence.xml but i have two databases. Those databases are identical, regarding the schema. What i am trying to do is: Persistence.createEntityManagerFactory("unit", primaryProperties); Persistence.createEntityManagerFactory("unit", secondaryProperties); The properties contain different ...

How can I manage to use 2 persistense units and make my app to recognize which to use?

I hava a JavaEE/ EJB3 application in which I'll need to connect diferent databases. It's on JBOSS 5.10GA. After I tried to deploy it I got the following error: 09:04:57,921 ERROR [AbstractKernelController] Error installing to Real: name=vfszip:/opt/jboss-5.1.0.GA/server/idiomas/deploy/idiomas.ear/ state=PreReal mode=Manual requiredStat...

Multiple JPA persistence units pointing to same database?

Can we have more than one JPA persistence units pointing to same database, in different Java projects and deployed on the server at the same time? By same time I mean, not deployed at the same second but deployed together. I am using a hsqldb database. I am having a client-server model for my project. I have one single unified database ...