Questions tagged [composite-id]
59 questions
1
vote
1 answer
Composite id in Hibernate
Good evening folks.
I'm developing an application which uses Hibernate 4.x. I'm currently having problems while using a composite id in a class and, mapping a relation of another class to this one.
I've got a ParadaBus object, which represent a Bus…

joninx
- 1,775
- 6
- 31
- 59
1
vote
1 answer
Dynamic Update with composite id hibernate
In hibernate, if dynamic-update is enabled, while updating the object it generates query for only modified columns
Consider a class with composite-id using components. Composite-id saveOrupdate the object. If the given key is not is DB, it adds…

Mohan Raj B
- 1,015
- 7
- 14
1
vote
2 answers
Hibernate composite id merge
I'm using Hibernate with JPA and have a relation like this:
@Entity
@Table(name = "first")
public class First {
...
@OneToMany(mappedBy = "first")
private List availabilities;
...
}
@Entity
@Table(name = "second")
public class Second…
user3659909
1
vote
1 answer
nhibernate query compositeid exception
I am getting an error on what looks to be quite a simple QueryOver. The complication is that the select involves a CompositeId.
The error I am getting is:
System.InvalidOperationException: variable 'x' of type
…

Bruce McGuire
- 37
- 5
1
vote
1 answer
(Fluent) NHibernate composite-id problem : MySQL complains that the parameter index is out of bounds
I'm using Fluent NHibernate to create an ASP.NET MVC project, with Submissions and Votes (Up/Down) by Users.
Of course, Users can vote submission Up or Down. To record this, I created a middle table, SubmissionVote, which contain the following…

Guillaume Gervais
- 1,035
- 2
- 14
- 26
1
vote
1 answer
Fluent NHibernate CompositeId trying to insert null values
I am working to map an existing database using Fluent NHibernate and have encountered a problem when it comes to complex many-to-many relationships (additional columns).
I know that many-to-many relationships with additional columns have to be…

Declan Dowling
- 61
- 1
- 3
1
vote
0 answers
Mapping association with Composite-id
I'm new on Hibernate, I've a doubt about how can I represent this case:
-->Table Message:
- (PK) MsgSender -> Foreign key to table 'User'
- (PK) MsgDestination -> Foreign key to table 'User'
- (PK) MsgDateSend
- MsgContent
- IsReaded
-->Table…

hecnabae
- 407
- 4
- 21
0
votes
1 answer
How to use an Interface as part of a CompositeID in fluent Nhibernate
I'm having trouble figuring out how to map an interface while using a composite key.
What I'm trying to do is this:
interface Ifoo
{
int someInt {get;}
int id {get;}
}
class bar1: Ifoo
{
int someInt {get; protected internal set;}
int id…

Zipper
- 7,034
- 8
- 49
- 66
0
votes
1 answer
Hibernate: Insert a new row by changing a portion of a composite-id primary key?
I am trying to insert new rows into the database but failing to get Hibernate to recognize that my objects must be inserted. I have a Sponsor table, a Course table, and a SponsorCourse table which is an intersection between the two. The primary…
0
votes
1 answer
loading objects from a list of composite-ids in nhibernate
what i want to do is to build an HQL Query which accepts a list of ids and returns a list of loaded objets. After a while, i found that something like this could work
from Foo foo where foo.ID in (:IdList)
However, this only works for single ids…

Watt
- 37
- 5
0
votes
2 answers
Fluent Nhibernate: key-referencing an entity with a compositeId
I'm experiencing issues with Fluent Nhibernate in mapping these relations:
Request entity:
id
date
School entity:
Composite id made of
name
request
property
Location entity:
Composite id made of
exists (boolean)
school (-> foreign key on…

gb.yolo
- 3
- 1
0
votes
1 answer
exposing composite ID through spring rest repository
I Have a domain object with
id
version
we want to show this in a table, so I need to get it in my rest request.
As suggested, I've implemented a
@Configuration
public class RepoConf extends RepositoryRestMvcConfiguration {
public…

bodtx
- 590
- 9
- 29
0
votes
1 answer
issue in implementing @IdClass
I am using jpa and hibernate as a jpa provider.
after learning the composite primary key concept in jpa, I am trying to implement the same using @IdClass annotation.
I have created a Project.java , in this I want to use deptId and projectId as my…

Ashish Parab
- 174
- 2
- 19
0
votes
2 answers
NHibernate: child composite-id is not updated when using merge()
Mapping:

Dmitry
- 1,220
- 2
- 11
- 18
0
votes
1 answer
How to get Composite ID object of new persisted entity?
I'm trying to get the (Embeddable) composite-id of an object newly persisted to the DB. I'm using mysql (myisam) with hibernate 4.3.5.
The insert operation itself succedes, but the category-id of the created java object is always null even I flushed…

bemar
- 334
- 5
- 11