jpa Questions

3

Solved

I'm using a PostgreSQL DB and I would like to start VACUUM FULL using JPA EntityManager. Version 1 public void doVacuum(){ entityManager.createNativeQuery("VACUUM FULL").executeUpdate() } thro...
Spinose asked 27/10, 2017 at 19:59

3

Solved

TestRepository extends JpaRepository<Test, Long> JpaRepository is an interface. Why do we extend it and not implement it as we know in Java? As far as I know, interfaces are implemented, not...
Aguirre asked 15/11, 2019 at 16:36

3

Solved

According to the documentation, the following usage is deprecated: @GenericGenerator( name = "UUID", strategy = "org.hibernate.id.UUIDGenerator" ) One shall use the new type...
Tirrell asked 19/7, 2023 at 16:12

2

I have some JPA classes and generate metamodel through org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor. So, one of my classes is: @Table(name = "USER") @Entity @NamedQueries({@NamedQuery(nam...
Unfounded asked 20/4, 2016 at 13:36

3

Solved

I have a Role enum, like this: public enum Role{ admin('a'), member('m'), pending('p'); char role; Role(char a) { this.role = a; } public char getRole() { return role; } public static R...
Hypognathous asked 31/12, 2019 at 13:54

9

Every time I run my code, I get the following error: java.lang.RuntimeException: javax.annotation.processing.FilerException: Attempt to recreate a file for type domein.ClubLes_ [javac] at org.ec...
Alton asked 7/5, 2019 at 10:13

3

Solved

I have a field id defined as below. It's varbinary(16) in database, when i am inserting a new record through JPA, i got "com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for colum...
Bonzer asked 4/6, 2014 at 3:24

4

I'm using the JPA CriteriaBuilder to select entities of type MyEntity from a MySQL db as follows: String regExp = "(abc|def)" CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery query = cb...
Kosiur asked 28/7, 2014 at 13:1

6

I want to use JPA with Spring on Wildfly. I tried this configuration: application.properties: spring.jmx.enabled=false spring.datasource.jndi-name=java:/global/production spring.datasource.driver...
Bedraggled asked 25/7, 2018 at 7:34

5

Solved

package com.abc.def.model; import javax.persistence.Column; import javax.persistence.Id; import javax.persistence.Entity; import javax.persistence.Embeddable; import javax.persistence.IdClass; imp...
Ballast asked 12/10, 2012 at 14:26

8

I am trying to build a web application, I didn't add any classes or packages I have just ran the app but it says java.lang.NullPointerException: Cannot invoke "org.hibernate.engine.jdbc.spi.Sq...
Forerunner asked 1/11, 2023 at 22:30

2

Solved

I have fairly typical scenario where there is a main @Entity and everything inside him is embeddable (so everything inside doesn't make sense without the parent). Now JPA 2.0 is blocking me to nest...
Bowe asked 2/3, 2014 at 10:24

7

Solved

I use JPA criteria API to fetch records from the datebase. I have entity Record with field dateTime which can be null. I would code: public List<Record> find(RecordFilter recordFilter, int p...
Sherburne asked 7/1, 2017 at 11:35

4

I have a custom repository declared like below(written in Kotlin): interface FooRepository : JpaRepository<Foo, Int> { fun findByFoo(foo: String): List<Foo> fun findByBar(bar: String...
Burdock asked 5/4, 2022 at 7:18

4

Solved

In my Hibernate JPA Sample code.. public List<AttendeesVO> addAttendees(String searchKeyword) { TypedQuery<AttendeesVO> query = entityManager.createQuery(" select at from AttendeesVO ...
Pyrrhic asked 2/1, 2013 at 9:0

4

We decided on using optimistic locking in our web application in order to increase concurrency and without the using of pessimistic locking. We are now on a lookout for retry solutions. We would ...
Sackett asked 10/2, 2014 at 8:44

12

Solved

If I run multiple threads against my web app I get: java.sql.SQLException: [SQLITE_BUSY] The database file is locked (database is locked) at org.sqlite.DB.newSQLException(DB.java:383) at org.sql...
Chapbook asked 15/12, 2012 at 9:24

13

Solved

I am a novice in hibernate world and facing, WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement org.hibernate.tool.schema.spi.CommandAcceptance...
Civilization asked 14/4, 2017 at 7:47

9

Solved

I'm trying to run a query that checks if some conditions are true and returns a simple boolean result as output. What makes it slightly tricky is that one of the conditions is to test for whether n...
Saunders asked 24/7, 2011 at 0:1

6

Solved

Project use Hibernate (JPA), Spring and Maven. My entity and DAO in a separate JAR. pom.xml: <project ...> ... <artifactId>database</artifactId> <dependencies> <de...
Valvular asked 25/1, 2013 at 13:24

2

I have a SpringBoot application with hibernate. In my tests I would like to disable any sort of db connection and configuration (tests don't have access to db). How should I do it ? My test class ...
Gdynia asked 23/10, 2019 at 7:10

5

for some reason I have not being able to find a suitable answer for this. I have the following simple entity: @Entity @Table(name = "simple_entity") @Access(AccessType.FIELD) public class SimpleEn...
Ampliate asked 21/8, 2013 at 6:19

16

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 follo...
Voracious asked 17/9, 2010 at 23:53

3

Solved

I'm having trouble with the ordering of the columns in my composite primary key. I have a table that contains the following: @Embeddable public class MessageInfo implements Serializable { privat...
Militant asked 15/11, 2011 at 16:13

2

Is it possible to get the associated persistence unit name of an EntityManager object? For example, you have @PersistenceContext( unitName="fooPU" ) private EntityManager em; Is it possible to ...
Cornhusking asked 9/11, 2013 at 7:6

© 2022 - 2025 — McMap. All rights reserved.