Questions tagged [entitymanager]

The EntityManager is the representation of a PersistenceContext, allowing a user to manipulate data pulled from a database.

1802 questions
0
votes
1 answer

How does merge operation work with one-to-many relationship - JPA

In my application, I have a tender entity. @Entity @Table(name = "tender") public class Tender { @Id @Column(name = "tender_id", unique = true, nullable = false) @GeneratedValue(strategy =…
vigamage
  • 1,975
  • 7
  • 48
  • 74
0
votes
2 answers

Correctly setting a new database connection within a Java Application?

I have a java application where I am trying to flag a person entity (corresponding to PERSON row in my db) if the record is over one year old. I.e. setting the OBSOLETE row in the DB to be "Y". I was getting the error: SQL Error: 2396, SQLState:…
java123999
  • 6,974
  • 36
  • 77
  • 121
0
votes
0 answers

Mapping a list of child objects in JPA - one to many

I am developing my first application using JPA. There I have a requirement that the parent object has a list of child objects and that list is not separately entered to its table. Here are my Entities. Tender :- @Entity @Table(name =…
vigamage
  • 1,975
  • 7
  • 48
  • 74
0
votes
2 answers

JPA EntityManager hibernate exception "detached entity passed to persist" due to timeout error

I support an application that often saves huge amount of data to database during a persist operation. The application runs smoothly for less amount of data. But when I try to persist huge amount of data, after a period of 30 min, it throws the…
0
votes
0 answers

Spring boot with two datasources

I'm trying to set up a spring boot project with two datasources. one for loading and one for storing. application prop. # Primary…
0
votes
2 answers

Updating an object using JPA / an entityManager

I have a Java/Spring web application that runs on Wildfly 10. I configured JPA and was wondering what a common approach is to do update and delete statements. Say for example an httprequest enters the server to show all the details about a Person…
user1884155
  • 3,616
  • 4
  • 55
  • 108
0
votes
1 answer

EntityManager Nullpointer Exception

I get a Nullpointer Exception for the EntityManager that I inject in my Bean. I already searched for solutions, but couldn't find anything in the posts, that helped me out. Also I don't understand why the error message is saying, that the error…
manban
  • 133
  • 1
  • 19
0
votes
1 answer

Difference between cascade remove and explicit remove

Suppose we have 2 entity classes Employee and Address and Address class is referenced in the Employee class: @Entity class Employee { : @OneToOne private Address address; : } If we use explicit remove: Employee employee =…
nSv23
  • 429
  • 6
  • 19
0
votes
1 answer

Table cannot be resolved jpa

I have a problem on my entity I put all the annotations and also I configured my file persistence.xml so that it generates a table automatically from the entity but I always get an error in the line @Entity that the table can not be resolved. Here…
AmineBena17
  • 23
  • 1
  • 5
0
votes
1 answer

Shouldn't EntityManager#merge work with non identifiable entity?

I'm designing JAX-RS APIs. POST /myentities PUT /myentities/{myentityId} I did like this. @PUT @Path("/{myentityId: \\d+}") @Consumes(...) @Transactional public Response updateMyentity( @PathParam("myentityId") final long myentityId, final…
Jin Kwon
  • 20,295
  • 14
  • 115
  • 184
0
votes
1 answer

SQL Error: 1795, SQLState: 42000 - maximum number of expressions in a list is 1000

SELECT ID FROM PERSON WHERE ID IN (:personIds) AND ( HAS_PAID IS NULL OR HAS_PAID = 'N') ; Into the query above I am passing a list of strings created earlier in my Java application. The above query is giving is giving the following issue for some…
java123999
  • 6,974
  • 36
  • 77
  • 121
0
votes
0 answers

select column in hibernate does not work but * does

I have this: Query q = em.createNativeQuery("select * from TRANSAKTION",Transaktion.class); List trans = q.getResultList(); While this works, using a column name like id doesn't although it exists in database and generated entity…
Jan V.
  • 180
  • 3
  • 12
0
votes
1 answer

Symfony: multiple entity manager (sonata)

I have a hard problem that wants an answear. I am working with Symfony and I installed Sonata to manage the admin area. After I completed to do that, my prompt line give me this error: This is the error This is my code: parameters: services: …
Alex Enax
  • 3
  • 1
0
votes
1 answer

EntityManager null pointer exception from Persistence Context Java EE

I have problem with using entityManager managed by EJB Container. In my ear i have 3 modules: -domain - There are Entity Classes and DAO Implementations with Interfaces as EJBs. -services - There I would have logic related with processing requests,…
0
votes
2 answers

JPA query not finding entity after persist

I have an AngularJS front-end which makes multiple requests to different resources on a Java back-end running Wildfly 10. Every resource endpoint queries the database (MySQL 5.6) to find the user using a unique user ID from the access token (It's…
Bruno
  • 33
  • 1
  • 8