hibernate-mapping Questions

2

Solved

I have many to many relation between user to role USER ENTITY: import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.pe...
Charlean asked 18/9, 2020 at 16:19

1

Solved

This is my abstract father: @MappedSuperclass public class AbstractEntity{ @ManyToMany protected Set<UserGroupAccess> userGroupAccesses = new HashSet<>(); @ManyToMany protected S...
Calorifacient asked 30/8, 2020 at 15:51

5

Solved

I have DAO implementation over spring-data: public interface TestDataRepository extends CrudRepository<DpConfigData, Long> { @Query(value = "select distinct(oid) from unit", nativeQuery = tr...
Forayer asked 23/6, 2015 at 19:28

5

Solved

In which case do you use the JPA @JoinTable annotation?
Segregation asked 29/3, 2011 at 20:10

5

Solved

Good morning Stackoverflow, I have the problem that it gives me the error: Failed to create sessionFactory object.org.hibernate.AnnotationException: Illegal attempt to map a non collection as...
Semipermeable asked 30/5, 2017 at 9:31

2

How can I persist Java 8 OffsetTime and OffsetDateTime with Hibernate as proper SQL types (TIME_WITH_TIMEZONE and TIMESTAMP_WITH_TIMEZONE)? I found a solution for LocalTime and LocalDateTime using ...
Carrol asked 23/3, 2015 at 13:14

2

Solved

I am mapping my classes with the tables of my database, but when running a test, I get the following error: Caused by: org.hibernate.AnnotationException: A Foreign key refering com.modulos.pvs.acc...
Cloninger asked 30/11, 2014 at 16:46

7

I'm trying to persist two different entities using JPA1, with the Hibernate implementation. The code for this is as shown below: Parent entity class @Entity @Table(name = "parent") public class P...
Camara asked 24/11, 2014 at 19:38

3

Solved

@JoinColumn gives an Entity a foreign key to another Entity whereas @JoinTable will list the relationship between all relationships between Entity A and Entity B. As far as I can tell, they both ap...
Diphyllous asked 17/5, 2015 at 15:20

4

I came to notice that the default FetchType for the @ManyToOne mapping is EAGER in JPA and Hibernate, whereas for the @OneToMany mapping, the default FetchType is LAZY. What is the specific reason ...
Nullification asked 17/12, 2014 at 6:15

2

Solved

As per Hibernate documentation, there are multiple annotations available if we want to use Map as an association between our entities. The doc says: Alternatively the map key is mapped to a dedi...
Indeed asked 22/8, 2014 at 4:56

3

I have a Spring Boot project which has multiple Model class I want to use multiple model classes in my DAO implementation. Can someone please explain how can I use HQL queries here. Most of the...
Inception asked 19/12, 2017 at 20:27

3

Solved

I am using Hibernate 3.2.5 for my application. I have a Dept table and an Employees table. Dept.java private int deptId; private String deptName; private Map empMap = new HashMap(); //Getters an...
Snowman asked 26/6, 2013 at 13:34

7

Solved

Following is my code Here I am using multiple lists to fetch data from database. On fetching data from hql query it is showing exception. Pojo Class public class BillDetails implements java.io.Se...
Nixon asked 10/7, 2014 at 11:26

3

Solved

Working on some legacy hibernate code. How do I do the following with hbm.xml(hibernate mapping file) instead of with annotations? @Table(name="users", uniqueConstraints = { @UniqueConstraint(co...

1

I am using below class but giving the exception like Caused by: org.hibernate.DuplicateMappingException: Table [] contains physical column name [scheme_name] referred to by multiple physical column...
Rothberg asked 20/8, 2018 at 11:54

1

Solved

I'm looking a way to bind Type for specific entity fields during entity manager configuration phase. I need it to be able to apply extra "rules" to target entity field using external source without...
Firebird asked 23/4, 2019 at 11:36

3

Solved

My Java bean has a childCount property. This property is not mapped to a database column. Instead, it should be calculated by the database with a COUNT() function operating on the join of my Java b...
Dimercaprol asked 6/6, 2010 at 23:14

3

Solved

I need to get data from database by enum type. I have following enum: public enum ShopType { VANS("VANS"), ATTICUS("ATTICUS"), FAMOUS("FAMOUS") ShopType(String label) { this.label = label; } ...
Balikpapan asked 29/9, 2014 at 18:36

2

Solved

I have the following MySQL update query with inner join: UPDATE Country AS c INNER JOIN State s ON c.CountryID = s.CountryID INNER JOIN City cy On s.StateID = cy.StateID SET c.Active='Y', s.Ac...
Rattlesnake asked 20/11, 2012 at 5:20

2

Solved

Can I configure Hibernate to scan packages automatically to create a SessionFactory from @Entity annotated beans ? Currently I am using Configuration config = new Configuration() ; config.addAn...
Juggle asked 6/2, 2016 at 19:45

3

Solved

I have a table that has foreign key of another table (many to one relationship) but i want it to be nullable. Something like this: public class SubType() { @Id @GeneratedValue(generator = "sys...
Sensual asked 8/9, 2014 at 6:2

3

Solved

I am trying to use Hibernate annotation for writing a model class for my database tables. I have two tables, each having a primary key User and Question. @Entity @Table(name="USER") public class ...
Verlie asked 15/3, 2013 at 7:14

1

I know that similar questions have already been asked for plenty of times but I haven't found one that could help me. So, could I ask you to help me to find the cause of why a Book's title is fetc...
Craft asked 3/9, 2018 at 17:50

4

Solved

I need to have GUID/UUID's as the id column of my rows. This is to be able to create entries both online and offline, and of course not having these conflict on PK when merging. I know i could mit...
Bedside asked 19/5, 2014 at 11:8

© 2022 - 2024 — McMap. All rights reserved.