Tagged Questions
2
votes
2answers
1k views
To create hibernate composite key using annotations
I am trying to use hibernate(annotation) to insert data to a MySQL database table which doesn't have a primary key defined. However the fact is 2 fields of that table together are unique in the ...
0
votes
2answers
353 views
How can I create a foreign key constraint using hibernate annotations?
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 ...
0
votes
4answers
88 views
How can i insert a row using hibernate method?
I am trying to insert a row into a relation table Stock Category.
I am following this example.
http://www.mkyong.com/hibernate/hibernate-many-to-many-example-join-table-extra-column- annotation/
...
0
votes
1answer
77 views
org.hibernate.MappingException: Repeated column in mapping for entity: Invoice column: INVOICE_ID
Hibernate is saying that mapping for the column INVOICE_ID is repeated. But I am unable to understand this exception. Please Help !!
My Invoice class is given below :
@Entity
...
0
votes
1answer
197 views
org.hibernate.MappingException: Could not determine type for: java.util.Set, at table: USERS, for columns: [org.hibernate.mapping.Column(invoices)]
I have a problem that Hibernate is unable to determine the type for Set at the table USERS.
I am trying to create a foreign key of table INVOICES through one-to-many relationship. One User can ...
0
votes
1answer
88 views
What is the best solution to add/delete a many-to-one mapped object with hibernate and struts
Ticket class:
@Entity
@Table(name="tickets")
public class Ticket implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
...
0
votes
0answers
54 views
3 level deep Hibernate Transaction doesn't Cascade until the root Entity when saved updated
I have a situation where I have 3 entities like this in HIBERNATE
public class Client extends AbstractEntity implements Serializable{
@OneToMany(fetch = FetchType.LAZY, cascade={CascadeType.ALL}, ...
0
votes
3answers
58 views
How i can find the exact error?
I am getting the below error. But i am unable to find what the error is.
Caused by: java.lang.NullPointerException
at ...
2
votes
1answer
49 views
How to update child when parent is deleted
my requirement is when i delete the parent ,child should not be deleted but instead of deleting child,one of the child column department_ID which is foreign key must be update with some value , say ...
0
votes
2answers
198 views
Deleting issue on parent to child relationship using hibernate annotation
Requirement is when parent is deleted all related child must be deleted .I am facing problem on deletion of child when parent is deleted using hibernate annotation my parent table is Employee and ...
0
votes
0answers
241 views
Hibernate annotations many to many inverse relationship with eager fetch
Hi there,
i have a model of user and role with many to many relationship as follows
@Entity
@Table(name = "USER")
@Indexed
@XmlRootElement
public class User extends BaseObject ...
1
vote
0answers
58 views
Two Entity with Common identifier @id in HIbernate
I am Using Spring3+Hibernate 3.0. I Have two beans (@Entity) Projects And Participants. I want both beans(Projects and Participants) should have common @ID identifier it means projects and ...
0
votes
1answer
434 views
org.hibernate.QueryException: duplicate association path for @ManyToOne Criteria
I have two classes which has a relationship between them. These are
com.edfx.adb.persist.Activity:
package com.edfx.adb.persist.entity;
import java.util.List;
import javax.persistence.Column;
...
5
votes
2answers
268 views
Strange Hibernate exception with column type
I am getting Hibernate exception:
Wrong column type. Found: bit, expected: BOOLEAN DEFAULT TRUE
I have class User:
package mypackage;
import javax.persistence.*;
import java.util.ArrayList;
...
1
vote
1answer
323 views
Doesn't work setting default value of property in Hibernate
I have a boolean property in my entity. Here's my annotations for it:
@Column(name = "IS_ACTIVE", nullable = false, columnDefinition="BIT DEFAULT 1", length = 1)
public Boolean getActive() {
...