Linked Questions

1 vote
0 answers
119 views

When we should use RESOURCE_LOCAL and when use JTA? [duplicate]

The flowing is my persistence xml file,So my question is ? Is it wrong that i used RESOURCE_LOCAL or not ? <persistence-unit name="default-persistence-unit" transaction-type="RESOURCE_LOCAL"> ...
Moolerian's user avatar
  • 552
136 votes
9 answers
261k views

What's the use of session.flush() in Hibernate

When we are updating a record, we can use session.flush() with Hibernate. What's the need for flush()?
CHANTI's user avatar
  • 1,425
53 votes
7 answers
34k views

What is the difference between LocalContainerEntityManagerFactoryBean and LocalEntityManagerFactoryBean?

Can anybody explain what is the difference between the Spring Framework's LocalContainerEntityManagerFactoryBean and LocalEntityManagerFactoryBean?
BlueSky's user avatar
  • 1,453
8 votes
5 answers
12k views

Java JPA Illegal Argument Exception - NamedQuery of name: xyz not found

I am trying to get a user based on their ID using this named query, however I keep getting an illegal argument exception. I've been looking at this code for awhile. Hopefully someone may catch ...
JianYA's user avatar
  • 2,944
3 votes
3 answers
13k views

PersistenceContext not injecting EntityManager

I am getting a NullPointerException when trying to access the EntityManager via annotation PersistenceContext import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax....
sotix's user avatar
  • 822
0 votes
1 answer
7k views

Unable to lookup JNDI name when building entity manager factory with Hibernate as persistence provider

my persistence.xml: <persistence-unit name="manager1" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> <jta-data-source>...
FuSsA's user avatar
  • 4,277
0 votes
1 answer
5k views

javax.ejb.EJBTransactionRolledbackException glassfish 3.1 with EJB

I have create Entity,DAo and Façade in a Web app. I have no error on my codes but I am getting this exception while using find(T.class,id) method of JPA.An also it says that there is no @Entity ...
emreturka's user avatar
  • 866
2 votes
1 answer
4k views

Injected Entity Manager not using correct persistence unit

I have a JAX-RS restful service which needs to access a MySQL database. I am trying to do this using CDI and a entity manager. However, when I publish the app, it appears that the incorrect ...
Paul Adams's user avatar
4 votes
1 answer
1k views

Why tomcat does not see the update in the database?

I am currently in netbeans I develop a web application with java. I use JPA2.0 with H2 Database. The problem is that when I change the data in the database and I reloaded the page in the browser=>no ...
Marwen Trabelsi's user avatar
0 votes
1 answer
3k views

Hibernate JPA too many connections

I keep hitting max number of connections after each web service call. It looks like EntityManager is being created every single time and creating a new connection to the database but it never fully ...
rubio's user avatar
  • 956
0 votes
1 answer
1k views

Can't get external MySQL server to work with Java web application + Hibernate. (Unable to build EntityManagerFactory)

I have two Virtual machines on an external server. VM1 is the Tomcat server and VM2 is the MySQL server. I have a web application on the tomcat server which I can access by typing the ip in my browser ...
Erik L's user avatar
  • 126
1 vote
1 answer
333 views

EntityManager handling

I am new to JPA 2 and I want to find out which are the best practices for handling an EntityManager on RESOURCE_LOCAL and with JTA. From what I have read, I should be able to make a dependency ...
Dragos's user avatar
  • 2,951
0 votes
0 answers
541 views

@Transactional guice annotation using JTA

We have an application running both in Weblogic and Tomcat. We use @Transactional annotation of Guice package to correctly perform the database operations using a persistenceUnit of RESOURCE_LOCAL ...
JSP749's user avatar
  • 137
0 votes
0 answers
520 views

EntityManager Throws NullPointerException

I am running the keycloak Photoz example. When I deploy to Wildfly, the EntityManager is not injected and I get a NullPointerException (below). I've tried a few different strategies -- tweaking ...
Brett's user avatar
  • 8,705
-3 votes
1 answer
392 views

What Transaction Manager (JTA) should I use to learn Hibernate?

I am learning Hibernate from the latest 2016 edition (2nd) of the Java Persistence with Hibernate book. It appears I need a JTA Transaction Manager (TM), but I do not want to have to learn Spring at ...
Jon's user avatar
  • 101

15 30 50 per page