Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
0 answers
34 views

JPA Composite Primary and Foreign keys that only share 1 field

I have the following DB model (all fields are not nullable): File SourceTypes ----------- ----------- country PK country PK filename PK sourcetype PK sourcetype sourcename ...
David Caballero's user avatar
4 votes
1 answer
4k views

How to use @GeneratedValue inside @Embeddable used as composite primary key?

I have in my data base one table with primary composite key, when I model it with Hibernate I use @EmbeddedId & @Embedable. One column of this composite primary key have a generated value with @...
BOSS_ladis's user avatar
2 votes
1 answer
986 views

JPA Hibernate Composite Key as Foreign Key Parent / Child saving

i am currently facing a problem within my application and would highly appreciate if somebody has an idea how to solve it. I have two DB Tables Item -------------- OrderID Status Detail --------------...
EillesDeveloper's user avatar
2 votes
2 answers
632 views

Hibernate composite pattern with many-to-many composition

I want to create a tree structure where each node can have multiple parents and children. (So actually it is not really a tree but more of a network). For example, we have an interface to implement ...
rghome's user avatar
  • 8,809
1 vote
0 answers
92 views

Why is hibernate composite object not complete after persist?

I am supporting a CRUD legacy application with relatively simple data model. In order to boost the performance by enabling lazy loading, I switched from a Hibernate session per DB query (openSession / ...
Alexandar Penkin's user avatar
1 vote
1 answer
91 views

How to retrieve data using composite key in hibernate

How can I retrieve data using a Composite key in hibernate? I have Roles tables and a Permissions table which is having a one-to-many relationship with the Roles_Permissions table. The ...
Nethre Paidi's user avatar
0 votes
1 answer
103 views

how to insert duplicate composite keys in onetomany default table in hibernate

The scenario is like: code table contains my master data which is independent from patient table but every patient requires to add multiple codes in them. The patient and codes table are joined ...
user3852293's user avatar
0 votes
1 answer
910 views

Composite Pattern Entities with JPA

Consider the following situation: I am using a composite pattern for a structure which I want to grab by the root out of the database and which implements a "cascade interface", the cascade function ...
Jading's user avatar
  • 3
0 votes
0 answers
363 views

Spring Join Single Column of a Composite Key

The Console Error: A Foreign key refering com.api.subscriber.pojo.MapperSubscriberTracker from com.api.tracker.pojo.Tracker has the wrong number of column. should be 2 public class ...
Brayden Hancock's user avatar
0 votes
1 answer
66 views

composite pattern, I am not able to retrieve all entities from the backend

I am trying to implement and use the composite pattern in my system. The problem is that I cant retrieve all the hierarchy of entities from the backend. I am not sure what is the problem, the fetch ...
Juano7894's user avatar
  • 790
0 votes
1 answer
482 views

Delete an Entity row using Composite Key Hibernate

Embedable Class @Embeddable public class SaTaskInterfacesId implements java.io.Serializable { // Fields /** * */ private static final long serialVersionUID = -...
KOFFEE's user avatar
  • 79
0 votes
1 answer
334 views

Hibernate - Composite Key from Embedded Class

i am facing a serious problem concerning composite Keys with Hibernate 4.3.9 Final and c3p0 4.3.8. First, I want to give you a little overview about my Entities ans Relationsships of my Database. ...
chifac08's user avatar
1 vote
1 answer
584 views

Composite primary keys in Hibernate with annotations

I´m trying to do the following relations using Hibernate + annotations: However, I get this error: "A foreign key referring *.street from *.house has the wrong number of column: should be 2". ...
Kimope's user avatar
  • 13
0 votes
2 answers
3k views

foreign key must have same number of columns as referenced primary key

This error seems to be very common and many people seem to have gotten this error. But unfortunately my problem seems to be different from theirs. In my case it seems hibernate cannot find primary key ...
Jitesh's user avatar
  • 244
0 votes
0 answers
233 views

Hibernate: ArrayList as a part of composite key

I have an entity describing the GPX track: package my.domain; import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.annotation....
Green Root's user avatar
-1 votes
1 answer
167 views

Bi-directional OneToMany error: why does Hibernate think I am using a composite key?

I am getting this infamous error: Foreign key (FK69848D5097EB6FB4:DOCUMENT_HISTORY [VOTERDOC_ID])) must have same number of columns as the referenced primary key (VOTER_DOCUMENT [VOTER_ID,ID]) ...
Robert Bowen's user avatar
3 votes
1 answer
2k views

Hibernate/JPA - Is possible to use @Id and @EmbededId at same time?

i´m a little confused to add a business key in my entity mapping. All entities uses Long as a Id, but now i have to create a composite Id, my doubt is, can i mixed @Id and @EmbeddedId together or only ...
LottaLava's user avatar
  • 889
2 votes
0 answers
635 views

Hibernate mapping on partial composite key

I have following table structure something like this, one to many and many to one mapped to one of the composite key. @Entity @Table(name = "parent", catalog = "testdb") public class Parent ...
aFish's user avatar
  • 43
4 votes
1 answer
6k views

Hibernate how to use a constant as part of composite foreign reference

I have a master table A with a composite primary key, consisting of two columns. One of these columns is a constant ("THE CONSTANT VALUE" in the code below). This table definition looks like the ...
Vladimir's user avatar
  • 457
2 votes
2 answers
2k views

Hibernate composite annotation

I am new to Hibernate, and am trying to map extra columns in a join table to the parent class. I could find an example at http://docs.jboss.org/hibernate/core/3.5/reference/en/html/components.html &...
Loke's user avatar
  • 349
1 vote
1 answer
2k views

Single class Composite Pattern mapping with Hibernate

I wonder how to map single class composite pattern with annotations in Hibernate? An human object can contains children, and each child can have his/her own children. Thank you. Human domain class: @...
janetsmith's user avatar
  • 8,712
4 votes
1 answer
12k views

Hibernate criteria problem with composite key

I got this hibernate mapping: <class name="CoverageTerm" table="coverage_term"> <composite-id name="id" class="CoverageTermPK"> <key-many-to-one name="productTerm" class="...
Dytut's user avatar
  • 317
0 votes
1 answer
2k views

Hibernate: Parent/Child relationship for a single table with composite key

A similiar topic has already been covered, but without the problem of having a composite key in the table. Basically I am trying to get a hierarchy tree out of a single table, which has the following ...
Antonio de Donato's user avatar
0 votes
1 answer
1k views

Composite Primary Key Not getting updated correctly with with EclipseLink. Where as with hibernate, it does. Why?

I posted all the code and an issue with selection here. Now I am going to ask one more problem I have seen with eclipselink which I havent seen with hibernate. Now that I managed to get loading ...
Arun Kandregula's user avatar
0 votes
2 answers
452 views

Querying my JPA provider (Hibernate) for a collection of <Id,Name> of an entity

I have an entity which looks something like this: Id (PK) Name Other business properties and associations... I have the need for my DAL (JPA with hibernate as provider) to return a list of the ...
Ittai's user avatar
  • 5,915
2 votes
1 answer
500 views

Composite ids between multiple tables in Hibernate

I'm pretty new with Hibernate, and I'm facing some trouble working with composite ids and foreing keys, I just want to make this work: ======= ======= Table A Table B ======= ======= atr1 ...
Joaquín L. Robles's user avatar
2 votes
2 answers
7k views

How to create an entity with a composite primary key containing a generated value

Using Hibernate + annotations, I'm trying to do the following: Two entities, Entity1 and Entity2. Entity1 contains a simple generated value primary key. Entity2 primary key is composed by a simple ...
David's user avatar
  • 920
3 votes
2 answers
998 views

How do you deal with composite pattern when using hibernate and domain-driven design?

Does hibernate has support for hierarchical data in a database where you use a parentId you use a parentId and an orderId you use Modified Preorder Tree Traversal
Lieven Cardoen's user avatar