All Questions
28 questions
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
...
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 @...
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
--------------...
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 ...
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 / ...
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
...
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 ...
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 ...
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 ...
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 ...
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 = -...
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.
...
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".
...
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 ...
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....
-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])
...
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 ...
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 ...
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 ...
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
&...
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:
@...
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="...
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 ...
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 ...
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 ...
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 ...
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 ...
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