relation 2 « Map « JPA Q&A





1. QueryDSL: querying relations and properties    stackoverflow.com

I'm using QueryDSL with JPA. I want to query some properties of an entity, it's like this:

QPost post = QPost.post;
JPAQuery q = new JPAQuery(em);
List<Object[]> rows = q.from(post).where(...).list(post.id, post.name);
It works fine. If i ...

2. UnsupportedOperationException merge-saving many-to-many relation with hibernate and JPA    stackoverflow.com

I've set up a simple many-to-many relationship account : role with Hibernate but when I try to save an account in a unit test after it has had its role added ...

3. Hibernate Lookup tables: As an Object Relation or as a code/key    stackoverflow.com

So, I'm working on an application with lots of relations and lookup tables, but It all boils down to this: Person

id INT (PK)
... (name, address, etc)
optcode VARCHAR (FK to Options)
typecode VARCHAR (FK ...

4. JPA relation Persistence    stackoverflow.com

I am using JPA 2 with following jars on class path

          [INFO] +- org.aspectj:aspectjrt:jar:1.6.9:compile
         ...

5. JPA Annotations for many-to-many relation between objects of the same entity    stackoverflow.com

I want to implement a Role Hierarchy but am rather new to JPA Annotations. I have a Role Entity with a name and an id(implicit via AbstractPersistable):

@Entity
@Table(name="role")
public class Role extends AbstractPersistable<Long> {
 ...

6. JPA Child Relation Persistence    stackoverflow.com

I am trying to persist JPA2 Entity

<access>FIELD</access>
<mapped-superclass class="com.compnay.qube.foundation.core.model.BaseModel">
    <attributes>
        <id name="uid">
           ...

7. Hibernate: Inconsistent primary key generation due to one-to-one relation    stackoverflow.com

I have two one-to-one relations here between a class called "MailAccount" and the classes "IncomingServer" and "OutgoingServer". (It's a Java application running on Tomcat and Ubuntu server edition). The mapping looks like this: MailAccount.hbm.xml

<hibernate-mapping ...

8. Working with relations in ORM    stackoverflow.com

What is the best/common solution (best practices) to working with relationships in ORM (from long-life project view)? 1) E.g. I have Oracle HR schema. Is it ok to create relations between every ...

9. ManyToMany relations in HQL    stackoverflow.com

I've got the following relations:

public class Group {

    private Integer id;
        (...)
    @ManyToMany(cascade=CascadeType.ALL)
    @JoinTable(name="rb_user_group",
  ...





10. JPA ManyToMany relation update failed due to constraint key in another relation    stackoverflow.com

While developing an Eclipse GEF application using an eclipselink implementation of JPA i have found an error that has been annoying me for a while: I have three different classes: The first one ...

11. Hibernate does not find persistent set    stackoverflow.com

I'm reading from a database using Hibernate. I am not too familiar with it, so maybe the answer is simple: I use the following simple code:

public static void main(String[] args) {
  ...

12. Additional information in the relation tables    stackoverflow.com

I have to 2 tables:
- object: contains all types of entities. For example "CobolProgram" and "Copybook".
- rel: contains relations between entities.
for example:
- program01 -> copybook01. ...

13. Hibernate @ManyToOne - only one direction relation    stackoverflow.com

I got classes:

@Entity
@Table(name="users")
public class User{

private Integer id;
private String name;
private Address address; 
}
and:
    @Entity
    @Table(name="adress")
    public class Adress{

      ...

14. Can I set an entity relation with just the ID?    stackoverflow.com

I have a JPA (Hibernate) entity:

@Entity class Transaction {

  @ManyToOne
  private Room room;

}
When I create a new Transaction, I know the ID of the Room that it should refer ...

15. Last Record of one to many relation Hibernate Criteria    stackoverflow.com

I need to get last record and the main record of one-to-many relation with Hibernate criteria. The Pseudo-Sql show the query I want to execute

Table1(Master)
Table2(Details)
Select * ...

16. Mapping many-to-many relation for class inheritance in Hibernate/NHibernate    stackoverflow.com

In the most simplified version , here is my problem enter image description here

public class D{
 public List<A> ListofA {get;set;}
}

public interface A{
}

public class B implements A{
}

public class C implements A{
}
class ...





17. Create relation between an entity and non-entity objects    stackoverflow.com

I have some domain object in my webapp named of Site. Site would be contains list of IP addresses, that is

@Entity
class Site {

    ...

    @ManyToMany(fetch=FetchType.LAZY)
  ...

18. Hibernate handle long 0 value instead of NULL in ManyToOne relations    stackoverflow.com

I use Hibernate to access to a legacy DB. For some tables the parent-child reference integrity is not enforced, and the long 0 value is used instead of NULL for some ...

19. ManyToMany relation deletes rows    stackoverflow.com

I got very weird situation. I got class A and B and relation ManyToMany like this: A.class:

@ManyToMany
    @JoinTable(name="a_b",
            joinColumns={
 ...

20. How to get Hibernate ResultTransformer to work with entity that have relations with other entities    stackoverflow.com

i have Employee , Role , Department domains

  • Employee , Role have many to many relationship.
  • Employee , Department have many to one relationship.
    @ManyToOne(cascade = CascadeType.ALL)
        @JoinColumn(name = "fk_department_id")
     ...

21. Getting repeated entries in table on a one-to-many relation    stackoverflow.com

I'm learning jpa and decided to do a basic webapp where a User can post Messages, so a user have many messages. The problem is that when I add a message ...

22. Hibernate @containedIn    stackoverflow.com

We have a server using spring and hibernate. We are trying to add hibernate search to the server but run into the following problem. We have a class Request with a relation ...

23. Java JPA - OneToOne Relation between Entities not working    stackoverflow.com

Licitatie Entity:

@Entity
@Table(name="licitatie")
public class Licitatie implements Serializable {
    ...

    //bi-directional one-to-one association to Licitatie
    @OneToOne(mappedBy="licitatie")
    private Produs produs;

   ...

24. Can an entity have more than one many-to-many relations?    stackoverflow.com

I have a table that has two different many-to-many relations to two different tables. Let's say I have User <---> UserRole <--> Role and User <--> UserGroups <--> Groups. Since I ...

25. m:n relations? ("Property not found on type org.hibernate.c...    seamframework.org

Hello all,I have a bit of trouble showing data retrieved through m:n relations. In particular, I am using a richDataTable to show "problems" and their "solutions". In the database, I have a "problem" and a "solution" table, as well as a "problem2solution" table which associates solutions to a problem.My code (snipped to the relevant parts): ...

26. Hibernate: one-to-many relation. Getting values    struts.1045723.n5.nabble.com

l1nk Reply | Threaded Open this post in threaded view | Report Content as Inappropriate Hibernate: one-to-many relation. Getting values Hi. Im developing a web application at work using Struts2, Hibernate and Spring. I have two classes with a parent/child (PCB - BrgpInfo) relation and i make one JSP page to insert data ...

28. Hibernate Newbie - 1 to Many Relation Tutorial    coderanch.com

This shouldn't be this difficult. One Contact can have One Country. One Country can have many Contacts. sql CREATE TABLE contact ( CONTACT_IDbigint(20) NOT NULL auto_increment , FIRSTNAMEvarchar(255) NULL, LASTNAME varchar(255) NULL, EMAIL varchar(255) NULL, COUNTRY_ID varchar(255) NOT NULL, PRIMARY KEY(ID) ) CREATE TABLE country ( COUNTRY_ID bigint(20) NOT NULL auto_increment , COUNTRY_NAME varchar(255) NULL, PRIMARY KEY(COUNTRY_ID) ) There really should ...

30. Hibernate: Updateing many-to-one relation    coderanch.com

I have a class mapping with a many-to-one relation where the many-to-one does not get updated. The class mapping is Customer and many-to-one related to Address. Address has its own mapping file too. When I retrieve Customer from database the Address also gets retrieved and stored into the Customer object. However. When I try to update it only updates Customer and ...

31. hibernate inheritance and relation    coderanch.com

32. Hibernate + Ternary Relation    coderanch.com

Hi Am having 3 entity classes Participant(participantId-ID), Artifact(artifactId-ID) & Status(StatusIs-ID, readStatus). There is a @ManyToMany relationship b/w Participant -> Artifact. As a result in mysql DB a new join_table Participant_Artifact got created. The structure of the Join table is Participant_Artifact Participant_participantId | Artifact_artifactId My requirement is to add the read status per participantId/per ArtifactId. i.e I need to create the ternary ...

33. using hibernate with tables have no relation    coderanch.com

I agree with Paul it's very hard to make it work with an ORM. Sherif why do you want to make a join or make a relationship with these two tables if they contain the same data? Maybe if you can tell us a little about what you're trying to do with it we can come with a recommendation, regards, [ ...

34. Hibernate InheritanceType.SINGLE_TABLE with different eager OneToOne relations    coderanch.com

Hi to all! I was trying to implements relations in a entity hierarchy build using single table strategy but i had some strange problems that i can't resolve I'm using: hibernate3-3.4.0.GA hibernate-annotations-3.4.0.GA hibernate-entitymanager-3.4.0.GA mysql-connector-java-5.1.6 Running a MySQL server 5.1.11. This is the structure: abstract MyBean with @Inheritance ( strategy = InheritanceType.SINGLE_TABLE ) MyBeanWithA extends MyBean and add a OneToOne eager relation ...

35. hibernate relations mapping    coderanch.com

Hi, Suppose that i have two hibernate entities, Emp and Dept where Emp has a Dept. Now, when loading and Emp i want its Dept to be loaded when i ask for it not by default loaded when loading the Emp. Is that possible ? Or it will be loaded by default ? Thanks,

36. JPA Many to Many Relation saving problem!    coderanch.com

HI All , I'm trying to implement Many-Many relation. But while saving the relation table is not getting saved. Means relation is not happening. Please suggest me .. code: EntityManagerFactory emf=null; EntityManager em=null; try{ emf=Persistence.createEntityManagerFactory("default"); em=emf.createEntityManager(); em.getTransaction().begin(); Author author = new Author(); author.setAuthorName("Clifford Geertz"); Author author1 = new Author(); author1.setAuthorName("JP Morgenthal"); HashSet authorSet = new HashSet(); authorSet.add(author); authorSet.add(author1); Book book = ...

37. How to create a identified 1xN relation using Hibernate?    coderanch.com

import javax.persistence.*; @Entity public class Player { private long id; private String nickName; private Team team; @ManyToOne @JoinColumn(name="team_id") public Team getTeam() {return team;} public void setTeam(Team t) {this.team = t;} @Id @GeneratedValue public long getId() {return id;} public void setId(long id) {this.id = id;} public String getNickName() {return nickName;} public void setNickName(String n) {nickName = n;} }

38. Relations like Many to One in Hibernate and Database?    coderanch.com

How do we represent Many to One/Many to Many relations of Hibernate in Database(Oracle)? Do we need to write the hibernate code based on Database table or inversely? (i.e Which is first , creation of the tables in Database then Hibernate code (or) Creation of POJO classes in Hibernate then creation of tables?

39. Help persisting a Many to Many Relation in JPA    coderanch.com

We Want to persist a many to many table with EclipseLink, we have just tried by setting the collections and persist but it returns error cause it seems that is requesting for all of the collections in the hierarchy, we are doing this cause the system did not mapped that table cause it has all of its fields as foreign keys ...

41. JPA: Count object relations in n:m relationship - do I need a native query?    coderanch.com

Hej, I am stuck at n:m relationships. I want to count the number of relations with JPA. Prerequisites: JPA (1.x atm), Hibernate as JPA provider, configuration by JPA annotations. Example: Item - Category (Student - Course would do also ) @Entity public class Item { @Id @GeneratedValue private Long id; @ManyToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) @JoinTable(name = "item_category", joinColumns ...

42. JPA relations become null when flushed    coderanch.com

I have a bidirectional relation between entity A and B - when flushed to the database the references in A to B are OK for the first few rows but then become null for the rest of the rows. This is how the bidirectional relation is defined: @Entity public class A { @ManyToOne(cascade = CascadeType.ALL) private B b; .. } @Entity ...

43. hibernate3 and EJB3 relation?    coderanch.com

Hibernate on it's own is an ORM framework. JPA which is part of EJB3 is a standard API for Java persistence. And hibernate has an implementation of JPA which you can use. Of course Hibernate has it's own native API that you can use without JPA, which is how hibernate being used from the beginning.

44. Outer Join in JPA without a relation    coderanch.com

Hi! I've a question: I have two EJB3 entities without a relation between them, let's say EntityA and EntityB.. Is it possible to write a JPA query using an Outer Join between these tables/entites without defining a relation in the entity classes? I know it is possibleto write a native SQL query, but I really would prefer JPA.. In native SQL ...

46. Retriving data from two tables where there is no physical relation ship in hibernate    coderanch.com

I have two tables HEADER and DESCRIPTION. description id is one of the non key column in the table HEADER and which is part of primarykey along with language id in DESCRIPTION. How do I need map this in Header.hbm.xml file to support CRUD operations. Please provide solution if any body faced the similar situation.

47. Relation between Hibernate Query Cache and Second Level Cache    coderanch.com

A cached query is a different thing from cached entities. Remember, queries do not necessarily load entities (i.e. select property1 from entity will just get that property). When you cache a query what you cache are the ids of entities that match the criteria when the query was run. Because of this, there is no point using the query cache if ...

49. Hard Hibernate relation    coderanch.com

Please help .. We have a table called "Users" one of the columns is called "User_type" and another table called group members... there is a complex relation ... can you please see attached image and help me with this ... sorry but I had to draw it because its hard to explain.... Many thanks in advance how this can be described ...

50. Funny Abstract Relation Name in JPA:What Does That Mean?    java-forums.org

After running a JPA query I created, I noticed that an abstract relationship id automatically appears - FK7877DFEBC08E54E5. I'm new to JPA. It appears with JPA you do not need to worry about creating relationships in database. All you need to worry about is Mapping. Am I right? Please I need some help, I'm new to JPA.

51. JPA: how to alter relation without fetching entire entities?    java.net

> > If it's going through a join table, then there may be an issue, but you have it listed as a OneToMany, but you don't have a join table. In this simple case, simply removing the address directly should work fine. > > Now, updating the join table is much more of a trick, as the join table entries themselves ...

53. JPA ManyToOne relation problem    java.net

54. How to update a @OneToOne relation?    forum.hibernate.org

@javax.persistence.Entity public class Contact { // ... private String firstName; @OneToOne(cascade = CascadeType.ALL, optional = true, fetch = FetchType.LAZY) private Address privateAddress; @OneToOne(cascade = CascadeType.ALL, optional = true, fetch = FetchType.LAZY) private Address commercialAddress; // ... ...

55. QBE on many to one relation    forum.hibernate.org

56. Any tag relation, meta value is null ?    forum.hibernate.org

57. Simple java.util.Map-relation    forum.hibernate.org

@Entity public class Parent implements Serializable{ @Id @GeneratedValue private Long id; @OneToMany(cascade=CascadeType.ALL) @Cascade ({org.hibernate.annotations.CascadeType.DELETE_ORPHAN}) @MapKey(name="parent_ref") private Map fvalues = new HashMap(); public void setChild(int ref, Child child) ...

58. [HQL] Select in one-to-many relation    forum.hibernate.org

59. Strategy for manually maintaining a relation    forum.hibernate.org

We have the following problem with manually administering a relation in our domain model. The application knows devices and users who are responsible for the devices. In fact the domain model is much more complex, but we can focus on these domain objects for now. One user is responsible for n devices, so we have an 1:n relation. A device has ...

60. Query on period-based many-to-many relation    forum.hibernate.org

61. Capital letters in relation names? (PostgreSQL)    forum.hibernate.org

63. Circular relation with annotations    forum.hibernate.org

class TItem @OneToMany(cascade = CascadeType.MERGE) @JoinColumn(name="parent") @Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN) private List children; @ManyToOne(cascade=CascadeType.MERGE) @JoinColumn(name="parent") @Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN) private TItem parent; @ManyToOne(cascade=CascadeType.MERGE) ...

64. How to create an identified 1xN relation ?    forum.hibernate.org

@Entity public class Book { @Id private int idBook; private String title; //getters & setters... } @Entity public class Edition { @Id private int idEdition; private int yearPublished; //getters ...

65. Using JoinFormulas in ManyToMany relations    forum.hibernate.org

I'm trying to overcome a problem joining on a table with a composite key using only one of the fields. I've seen some examples using @JoinFormula to get around this, and I upgraded to beta to take advantage of that. However, many of my cases are ManyToMany, and I can't find a way to annotate this. Here's an example: @ManyToMany @JoinTable(name="TBLCUSTOMER_CONTACT", ...

66. @ManyToMany loss of relation on update    forum.hibernate.org

Hi, I have the following problem: I have a many-to-many relationship between Users and Applications. I create an application. Get the user.getApplications(). add the appliction to the list. call user.setApplications(). And merge the user. This works great, the application is stored in the database and also in the relation-table (user_applications). Now when i do a entityManager.find(), i get the user object, ...

67. hibernate 1:n relation, cascading    forum.hibernate.org

Hi, I have some problems with a 1:n relation and cascading: a point of interest (POI) can have n addresses, the owner should be the POI (ONE side). If I persist a POI, all attached addresses should be persisted as well. POI File: Code: private Collection lpAddress; @OneToMany() @org.hibernate.annotations.Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE) ...

68. [Mapping] manty-to-many with relation attributes    forum.hibernate.org

CREATE TABLE student ( "std_id" SERIAL NOT NULL, "std_firstname" VARCHAR(125), "std_lastname" VARCHAR(125), .... CONSTRAINT "pk_student" PRIMARY KEY("std_id"), .... ); CREATE TABLE address ( "adr_id" SERIAL NOT NULL, "adr_postcode" SMALLINT(4) NOT NULL, ... CONSTRAINT "pk_address" PRIMARY KEY("adr_id") ); CREATE TABLE contact ( "con_id" SERIAL NOT NULL, "con_name" VARCHAR(255), "adr_id" INTEGER, ... CONSTRAINT "pk_contact" PRIMARY KEY("con_id"), CONSTRAINT "fk_contact_address" FOREIGN KEY ("adr_id") REFERENCES "address"("adr_id") ...

69. Don't know how to map an strange relation    forum.hibernate.org

I have an strange relation among several tables. There are 3 main tables PERSON, ROLE and CONTEST. Each has an autonumeric PK. Names are IDPERSON, IDROLE, IDCONTEST Originally the application had a relation table called ROLECONTEST: PK = IDROLECONTEST FKs = IDROLE, IDCONTEST Other data Another relation table that related ROLECONTEST and PERSON called PERSONROLECONTEST PK = IDROLECONTEST FKs = IDROLECONTEST, ...

70. Many to many relations, saving the Set    forum.hibernate.org

Author Message Passero Post subject: Many to many relations, saving the Set Posted: Fri Feb 12, 2010 1:01 pm Newbie Joined: Wed Aug 01, 2007 4:53 pm Posts: 11 I have this application i am writing were i have some many to many relations. I have problems storing those... For example a case from my application: I have students ...

71. Parent Child relation generates update after insert    forum.hibernate.org

hello, I have a parent with a set of child elements (one-on-many). When I add a child to the parent and do saveOrUpdate with parent, the child is first inserted into the database and then updated to set the parentId in the child-table. I can see the INSERT and UPDATE statements on the child in my logging. Every child has a ...

72. ManyToMany relations and row limit    forum.hibernate.org

Hi, I'm using Hibernate in a Spring DM / OSGi environment. Works great, however I am running into an issue with ManyToMany relations when using limited result sets. Let me explain using an example. Code: public class Person { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name ...

73. using MappedSuperclass in relation one to many    forum.hibernate.org

Newbie Joined: Thu Mar 17, 2005 5:50 am Posts: 12 I have a hierarchy of classes as follows Enterprise (abstract) ^ |_ Vendor |_ Implementer |_ Customer each of the three subclasses have a relation one to many with class ContactPerson so I have to put three keys in ContactPerson table which always have 2 of them null is there a ...

74. Using derived properties to establish transitive relations    forum.hibernate.org

Hi Hibernate Community, I have the following usecase: Three classes C1,C2,C3 are related like this: C3 has_a C2 has_a C1 I now like to establish a kind of transitive relation from C3 via C2 to C1. Imagine an access control implementation based on C1 as some kind of permission. A user may access c3 based on its permission for c1 and ...

75. How to create and Handle M:N relation with additional link.    forum.hibernate.org

The book 'Java Persistence with Hibernate' treats this topic under the section 'adding columns to join tables' , chapter 7.2.3. There are different 2 approaches to realize this: 1. Mapping the join table to an intermediate entity 2. Mapping the join table to a collection of components Unfortunately this topic is to complex to report it here (I would have to ...

76. Big problem (bug) - one-to-many relations in subclasses    forum.hibernate.org

I think there's a probable bug in Hibernate when it comes to one-to-many relationships concerning subclasses that share the same properties. I am trying to model 3 beans - EducationFacility, Director and Teacher. Director and Teacher extend from UserAccount EducationFacility contains 1 director EducationFacility contains multiple teachers Director and Teacher have a link back to EducationFacility. The bug is when Hibernate ...

77. Hibernate: order multiple one-to-many relations in the DB    forum.hibernate.org

I have a search screen, using JSF, JBoss Seam and Hibernate underneath. There are columns for A, B and C, where the relations are as follows: A (1< -- > many) B (1< -- >many) C A has a List< B > and B has a List< C > (both relations are one-to-many). The UI table supports ordering by any column ...

78. Getting sliced one2many relation    forum.hibernate.org

Hi, having some one2may or many2many relation, and having mapped it to hibernate as sets or any other way I need to get these relations in a sliced mode, I mean, in case there are a lot of related entities (millions) I want to get one range (30-60). I would do that with startIndex and endIndex If I knew the query ...

79. Relation Caching / Cursor    forum.hibernate.org

Hello, I am loading a OneToMany-Relation with a huge amount of results on the many side. Is there any way in Hibernate not to cache all the objects as soon as the first object is accessed (lazy loading) but to just read batches of for example 10 objects from the database with a cursor or sth similar? All I have found ...

80. id not cascading to relation    forum.hibernate.org

81. 1:1 Relation shared primary keys    forum.hibernate.org

Hello, ich tried to establish a 1:1 relation between 2 tables but it doesn't work. Above is the code, I get the following exception: Quote: ids for this class must be manually assigned before calling save(): at.eventtiming.domain.Contact; nested exception is org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): at.eventtiming.domain.Contact Code: public final class DaoMain { ...

82. Wrong entity attached in one-to-one relation.    forum.hibernate.org

Hello, I have this awkward problem that randomly wrong entity is attached to the entity. Here are the somewhat changed (names) mapping files: Code: ...

83. Soooo many "one to many" relations    forum.hibernate.org

Hello, i'm new to both Hibernate and this forum. I have a database schema with a lot of foreign key constrains; when i run my reveng hibernate tool task, it create a one-to-many relation for every single foreign key declared in the database schema. Is it advisable to mantain all of these collections/sets or it would be better to remove the ...

84. Sorting in one to many relation    forum.hibernate.org

Dear all, I'll be thankful to you if you can save me from this problem. 1st of all I'm a very beginner in Hibernate and JPA. I've 3 tables A, B and C. A has columns a1 (primary key),a2 and a3. B has b1, b2, b3, a1 and c1. C has also the same. Table A has one to many relationship ...

85. Mapping problem for manyToMany relation    forum.hibernate.org

Newbie Joined: Sun May 30, 2010 9:11 am Posts: 1 Hi, I could not manage to configure my model with annotations Basicly i need many-many table with additional fields here is my model Code: Props String name List propItems PropItem String name Advert_Props Advert ...

86. Error Saving ManyToMany Relation into DB with Java Persisten    forum.hibernate.org

Author Message flylight Post subject: Error Saving ManyToMany Relation into DB with Java Persisten Posted: Sun May 30, 2010 3:55 pm Newbie Joined: Sun May 30, 2010 3:46 pm Posts: 3 SUBJECT: Error Saving ManyToMany Relation into DB with Java Persistence :) Hello everyone! I thank you in advance for the given time and patience. My Java code follows ...

87. many to many relation with extra column    forum.hibernate.org

Newbie Joined: Tue Jun 01, 2010 3:41 am Posts: 1 Dear experts, I am facing problem in composite-element mapping of hibernate. My expected relation is many to many in document and task. That is a task may have multiple documents and a document may have assigned to multiple task. Relational table will contain both foreign keys with additional column. My Task ...

88. N:M relation -> additional data field    forum.hibernate.org

Hello! I am a Hibernate newbie and I have this relation to include: I have projects and I have users. One Project can have many Users and one User can be in many Projects, so I have a n:m relation between these two entities. A User-Project relation is also "identified" by the role of a user in a project, for example ...

89. Many-to-many relations with attributes - saving to database    forum.hibernate.org

16.06.2010 13:41:02 org.hibernate.LazyInitializationException SCHWERWIEGEND: could not initialize proxy - no Session org.hibernate.LazyInitializationException: could not initialize proxy - no Session at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:57) at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111) at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:150) at eventmngr.User$$EnhancerByCGLIB$$26e300d8.getEmail() at org.apache.jsp.addAttendee_jsp._jspService(addAttendee_jsp.java:73) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) at ...

90. One/ManyToMany relation in MappedSuperclass    forum.hibernate.org

Hi, I have a question regarding a superclass defining OneToMany and ManyToOne relations. I have the following hierarchy: BaseClass |_ A |_ B |_ C Comments Each class (A, B, C) has a one to many relation to Comments. DB tables are table_A, table_B, table_C and table_comments (and that must not be changed) I would like to define a relation in ...

91. TransientObjectException with Parent/Child relations    forum.hibernate.org

Hi, I have a basic one to many relation parent / child like in the chapter 21 of Hibernate references. The cascade is from child to parent (persist cascade only because i don't want to delete the parent if I delete a child). When I add a child to the parent and I save the child, I have a TransientObjectException... Code: ...

92. many to many relation    forum.hibernate.org

many-to-many relation: ---------------------- i have table A, table B , link table or reference table C Table A Table C Table B AId AId BId AName BId BName as table c is link table it contains the two foreign keys(AId,BId)........ as this relation is many-to-many the mapping file for TableA ie A.hbm.xml is ...

93. many to many relation    forum.hibernate.org

many-to-many relation: ---------------------- i have table A, table B , link table or reference table C Table A Table C Table B AId AId BId AName BId BName as table c is link table it contains the two foreign keys(AId,BId)........ as this relation is many-to-many the mapping file for TableA ie A.hbm.xml is ...

94. many to many relation    forum.hibernate.org

many-to-many relation: ---------------------- i have table A, table B , link table or reference table C Table A Table C Table B AId AId BId AName BId BName as table c is link table it contains the two foreign keys(AId,BId)........ as this relation is many-to-many the mapping file for TableA ie A.hbm.xml is ...

95. createAlias for one to many relation    forum.hibernate.org

96. Hibernate cache and relations    forum.hibernate.org

Hi, i am trying to get the 2nd level cache working properly with different kind of relations. According to what i've read the following is true: OneToMany: Changes have to be done on both sides (setParent on the many side and collection.add on the one side). If something deleted by Cascade.DELETE i have to evict all affected collections from the cache. ...

97. Cant cascade delete on Many-To-One relation (MySQL)    forum.hibernate.org

Author Message marcus_cps Post subject: Cant cascade delete on Many-To-One relation (MySQL) Posted: Wed Jul 28, 2010 12:02 am Newbie Joined: Tue Jul 27, 2010 11:34 pm Posts: 1 Hi, I started using Hibernate recently and I'm still a newbie, however, the error I'm facing doesn't seem to be simple. My current environment is: Windows 7 MySQL 5.1.49-community mysql-connector-java-5.1.13-bin.jar ...

98. wrong sql generated when accessing a one-to-one relation    forum.hibernate.org

@Entity public class Post implements java.io.Serializable { ... @OneToOne(cascade = CascadeType.ALL) @PrimaryKeyJoinColumn public Car getCar() { return this.car; } } @Entity public class Car implements java.io.Serializable { ... @OneToOne @PrimaryKeyJoinColumn public Post getPost() { ...

99. JCS cache: on class and/or relations ?    forum.hibernate.org

100. findByExample method with relations    forum.hibernate.org