Persistence Unit is a logical grouping of user defined persistable classes (entity classes, embeddable classes and mapped superclasses) with related settings.
Questions tagged [persistence-unit]
80 questions
2
votes
2 answers
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)
rave
2
votes
1 answer
JBoss Wildfly 9 - Multiple Datasources and PersistenceUnits
after upgrading from JBoss EAP 6.1 to JBoss Wildfly 9 I've got a problem with multiple XA-Datasources and the related PersistenceUnits.
I'm using an Oracle Database with different users/schemas. I've configured 2 XA-Datasources which are using the…

AnarchoEnte
- 558
- 4
- 20
2
votes
0 answers
Use PersistenceContext in JavaSE
I want to call the BookDAO in my modelproject, which uses the annotation @PersistenceContext. Because I work in a Java SE project, the annotation will not work. Is there any posibility to keep the annotation for my Webapplication and to use this…

Tarenitaire
- 63
- 6
2
votes
1 answer
"Invalid authorization specification" error on UCanAccess connect
I am having a problem with the UCanAccess driver namely that when I attempt to connect to a database using the following code
public static void main(String[] args) {
//establish connection with database in order to execute sql queries
try…

kyle hendry
- 57
- 7
2
votes
2 answers
Create Entity Manager Factory without persistence.xml
Is there a way to create the EntityManagerFactory without a persistence unit defined? Can you give all the required properties to create an entity manager factory? I need to create the EntityManagerFactory from the user's specified values at…

Gaurav Kumar
- 323
- 2
- 4
- 10
2
votes
1 answer
Java persistence.xml multiple persistence-unit "cannot find symbol ... import"
i got a Problem with my NetBeans-Maven-Project.
If i add another Persistence-Unit into the same persistence.xml with the same Entities, i get some Exceptions i dont understand.

Zack
- 51
- 1
- 5
1
vote
1 answer
Load persistence unit with vfsfile (exploded JAR) on JBoss 5.1/Hibernate 3.3.2
I am looking for help to fix a problem to appeared when migrating from JBoss4 to JBoss5.
There seems to be an issue with Hibernate support for VFS (introduced in JBoss5).
For modularity reason, multiple artifacts have persistence unit (pu)…

Olivier.Roger
- 4,241
- 5
- 40
- 68
1
vote
1 answer
Is it possible to inject a context specific PersistenceContext?
In a jsf application data is managed injecting a PersistenceContext.
@PersistenceContext(unitName = "MyPU")
private EntityManager em;
PersistenceContext is static and choosen at compile time. Is there a way to inject a different…

Filippo
- 1,123
- 1
- 11
- 28
1
vote
1 answer
Hibernate : Error in persistence.xml - Element 'persistence-unit' cannot contain text content. The content type is defined as element-only
I'm using Hibernate and the below persistence.xml was working fine. But after creating a new JPA entity from Table in eclipse, persistence.xml is giving error - Element 'persistence-unit' cannot contain text content. The content type is defined as…

Neethu S
- 13
- 3
1
vote
3 answers
Glassfish Deployment out of Eclipse Helios SR2 fails
I experience a strange Exception which occurs when I try to deploy my Java EE application out of the latest Eclipse version (Helios SR2 with the Glassfish adapter version 1.7.1) to the latest Glassfish (3.1).
If I deploy the war file manually to the…

Fabian
- 21
- 4
1
vote
1 answer
persistence unit gets overwritten
I'm coding a standalone java application, build it from a Maven project and executed by calling the jar file.
In the application I have an entity manager using a persistence unit, defined in my persistence.xml to be standalone…

J. Doe
- 19
- 4
1
vote
1 answer
Is it possible for two Java EE applications to share the same persistent unit and data source
We are developing a sort of SDK for internal use which includes some custom annotations, request filters and a few JPA entities for storing information about our organization's users. The SDK is a maven artifact and includes the definition of a…

KG6ZVP
- 3,610
- 4
- 26
- 45
1
vote
0 answers
Tomcat JPA PersistenceUnit JNDI Name
I've developed a JPA project to be deployed into my Tomcat8 instance.
I need then to lookup my PersistenceUnit EntityManagerFactory by JNDI context lookup. I know that with JBoss Wildfly there is the possibility to use:

Alex
- 1,515
- 2
- 22
- 44
1
vote
1 answer
Hibernate Mapping Errors due Seperate Modules in IntelliJ?
Using several modules with independent Hibernate Instances
I am creating a multi-module maven project with modules ModuleA and ModuleB below the parent.
Hibernate throws a MappingException
The modules use their own Hibernate mapping with a own…

Stefan
- 679
- 2
- 9
- 21
1
vote
1 answer
JPA persistence unit into file?
I use JPA to persist my data to a MySQL database and it all works pretty fine. Now I need to store a couple of configurations on the system the program is executed from.
In past I would have created a settings.ini or a settings.xml file and pretty…

Socrates
- 8,724
- 25
- 66
- 113