relationship 1 « Map « JPA Q&A





1. JPA mapping: Reusing entities in multiple relationships    stackoverflow.com

Let's say I have:

class Unit {
    private TextContainer source;
    private List<TextContainer> targets;
}
Can I annotate class TextContainer in such a way that it works within both ...

2. Mapping Relationships with Hibernate    stackoverflow.com

I'm still learning how to set up these mappings using the JPA annotations so this may be a beginner mistake. I have a User class and a Course class. In the database ...

3. How to implement One-to-Many mapping when the associative table is one for all one-many relationships?    stackoverflow.com

General case: first table represents one-side, second table represents many-side. Third table serves as a link between the two. My case: first and second tables are the same. Third table serves ...

4. Hibernate: Parent/Child relationship in a single-table    stackoverflow.com

I hardly see any pointer on the following problem related to Hibernate. This pertains to implementing inheritance using a single database table with a parent-child relationship to itself. For example:

CREATE TABLE Employee ...

5. JPA Problems mapping relationships    stackoverflow.com

I have a problem when I try to persist my model. An exception is thrown when creating the EntityManagerFactory:

Blockquote javax.persistence.PersistenceException: [PersistenceUnit: ASD] Unable to build EntityManagerFactory ...

6. hibernate modeling relationships managed through an intermediate table    stackoverflow.com

I have a datamodel that has an intermediate table to manage relationships between entities. For example, tables Person and Organization are related through the Relationship table Party (table) - ID Person (table) - ID ...

7. Quering JPA TABLE_PER_CLASS mapping on One to One relationship    stackoverflow.com

I am trying to map a JPA (using Hibernate) one-to-one relationship with a inheritance strategy TABLE_PER_CLASS. Here is an example:

@Entity
public class DrivingLicense {

    @OneToOne(targetEntity = Human.class, cascade = ...

8. How to map this relationship in Hibernate?    stackoverflow.com

I have 2 tables : The table Data : id, plus many fields. Some of these fields are 'codes' which reference multilanguage values from the next table, for example country_code, continent_code. The table ...

9. Mapping a map collection with JPA annotations    stackoverflow.com

Hi guys I am migrating an application using hibernate from xml to JPA annotations. Currently I am stuck on mapping a map of objects with compound id using annotations This is how am trying ...





10. JPA mapping relationships issue    stackoverflow.com

I am having a little issue when ussing JEE6's JPA API to map entity relationships. I just created the domain model, annotated all the classes attributes and relationships and also added the ...

11. JPA/Hibernate Parent/Child relationship    stackoverflow.com

I am quite new to JPA/Hibernate (Java in general) so my question is as follows (note, I have searched far and wide and have not come across an answer to this): I ...

12. Hibernate query to return results of many-to-many DB relationship without the relationship being mapped    stackoverflow.com

I am new to Hibernate when it comes to writing mapping files and understanding best practices for mapping entities that are not necessarily intended to be POJOs. I have a many-to-many relationship ...

13. Hibernate Annotation Mapping for Parent/Child Relationship?    stackoverflow.com

I'm having problems mapping ManyToOne from a Parent to Child relationship. The OneToMany collection populates lazily fine. However, the inverse to a single entity, does not. I have a table ...

14. How to map one-to-one relationship for multiple tables in Hibernate    stackoverflow.com

I've got a table which is in one-to-one relationship with several other tables and I can't find a way to map it correctly in Hibernate. The reason why I need so ...

15. Define Mapping relationship with JPA    stackoverflow.com

I am having difficulties to figure out what's proper way of defining the following relationships with JPA2 mapping.

create table TableA {
  id int primary key
  name varchar(255) not ...

16. Is it possible to map two relationships with a single column?    stackoverflow.com

I am working with JPA on a legacy database. The actual semantics are that foo owns the relationship, and that it really only has a single bar, which would require an ...





17. Hibernate: Parent-Child Relationship to Itself    stackoverflow.com

I have two tables: TABLE NAME: TABLE_A

A_ID
A_CODE
A_DESC
TABLE NAME: TABLE_B
B_ID
B_TABLE_A_PARENT_ID
B_TABLE_A_CHILD_ID
Where: The TABLE_A's A_ID can be entered in TABLE_B's B_TABLE_A_PARENT_ID and B_TABLE_A_CHILD_ID to create relationship to itself. My Code:
@Entity
@Table(name = "TABLE_A")
public class TableA{
private int id;
private String ...

18. Hibernate mapping accross tables (possible JOIN relationship)    stackoverflow.com

Can hibernate resolve mapping across more than one table. Here is example:

  • Class Manufacturer, table MANUFACTURER
  • Class Car, table CAR Class
  • CarType, table CAR_TYPE
ORM Model
  • MANUFACTURER one to many CAR (MANUFACTURER_ID_FK in table CAR)
  • CAR many ...

19. Mapping an aliased table relationship in Hibernate Annotations    stackoverflow.com

I am trying to map a relationship in Hibernate that exists in the tables like so:

PRODUCT table
Product ID

PRODUCTMASTERMAPPING
Product ID
Master Product ID
Normally, in SQL world, I would write a query aliasing the ...

20. Relationship and hibernate mapping    coderanch.com

Hi There, Please help me on how to create the tables for the below scenario and the Hibernate mapping. I have the below properties that can take values Yes or No, Married ..? Yes/No Employed...? Yes/No US Citizen ..? Yes/No I have an object called "Person", So when ever a new Person is created, I have to get and store the ...

21. Hibernate: unexpected queries in parent/child relationship    coderanch.com

Could someone point out what I'm doing wrong? I have a parent/child relationship between two objects, Customer and Order - a customer can have many orders. The tables are setup the same way and the two join on a pk/fk field called 'cust_id'. So...it looks like this: Customer- (mapped as a bag, like so): ...

22. Hibernate: Parent-Child Relationship    coderanch.com

23. Hibernate mapping of many-to-many relationship with a joining table    coderanch.com

I'm a newbie in hibernate but i know the basic mapping like one-to-many and many-to-many. However, i was stuck on a certain scenario and i've been trying to solve this and search through the internet but unfortunately couldn't find any solution. The scenario basically is i have many-to-many relationship (foo and bar see example below). -------------- HBM/Class Foo --------------

24. Regarding Hibernate Relationship Mappings - Srinivas    coderanch.com

Hi Mr. Srinivas, Hope that all is well. I have an issue with Hibernate Mappings. They seem to work well when mapping two related objects that have composite id's, as long as the mapping does not involve id's in the two objects. I can map an order to many requests by having the request as an attribute List in the order ...

25. hibernate parent/child relationship    coderanch.com

Hi, I m new to hibernate. I have written a Hibernate test program on the parent / child relationship but I m getting below exception: Caused by: java.sql.BatchUpdateException: ORA-02291: integrity constraint (ATSUSER.BOOK_R01) violated - parent key not found The idea is an author can have many books: Below are the details: Test Program public class Book_test { public static void main(String[] ...

26. JPA mapping with inheritance, elementcollection and many-to-many relationship    coderanch.com

I have an abstract class Syncable and three concrete classes Library, Book and Magazine. Syncable defines the primary key. I want to map them to a MySQL database using JPA 2 (implementation eclipselink 2.2.0) and I'm using the joined strategy. The classes are deployed as a ejb-jar in an ear on GlassFish 3.1 @Entity @Table(name = "SYNCABLE") @Inheritance(strategy = InheritanceType.JOINED) @DiscriminatorColumn(name ...

27. Malformed query in one-to-may relationship +inheritance    forum.hibernate.org

I'm getting a malformed query when getting the relationaship 'asegurados' with the following configuration: 'Asegurado' class is an inherited one...

28. A question on parent-children relationship    forum.hibernate.org

In a parent-children relationship of a pair of classes, the key in the child class is a compound one with its parent key as one of components. This design seems to be good for data retrieval. I, however, need to make a few twists on the code. The data insertion operations is the follwoings: save the A instance first, get its ...

29. How to map One-To-Many relationship with annotatios    forum.hibernate.org

Hi all, I have two tables, one is 'caller' and other is 'passenger' relationship is one caller can have many passengers. in 'caller' table 'caller_id' is the primary key, in 'passenger' table 'passenger_id' and 'caller_id' are the composite primary key. 'caller_id' is the foreign key of the 'passenger' table. I did this like this in my classes. Code: package com.trn; @Entity ...

30. Mapping a ParentId relationship to same class doesn't work    forum.hibernate.org

Comrades, My database table has a parentId field that maps to the (primary key) itemId field of the same table. This is a one-way relationship. Rows don't need a link to the child, and neither do the Entities they map to. I've found examples where a parent column maps to a different table, but I've never found one for the same ...

31. Unusual "parent/child" relationship not covered in examples    forum.hibernate.org

Okay. I have no trouble with most parent-child relationships. My code is filled with them and they work fine. But I have one that doesn't work because it's built differently, and none of the examples cover it. The case is where my parent and child are the same class, and hence use the same database table, like this: Code: CREATE TABLE ...

32. How to map the other side of an @Any relationship    forum.hibernate.org

I have a situation where a persistent object can be 'owned' by one of several classes that implement a given interface. I have used the @Any annotation to successfully map the 'child' portion of the relationship (see class Attribute Group below). What I cannot seem to get to work is the 'parent' side of the relationship. (see class AdhocMaterialGroup below) When ...

33. Can I map a one-to-many relationship as one-to-one?    forum.hibernate.org

I've tried that before, but was not sucessful. As you said, it only acts in the SQL statement. The relationship is still many-to-one. Same for @Filter. I'll keep it that way. I didn't know those where clauses in my HQL would be applied to each element in the collection. So the query is still ok. Thanks.

34. Many-to-one relationship for an inherited class    forum.hibernate.org

...

35. Parent child relationship mapping and inheritance trees    forum.hibernate.org

I was wondering what the best mapping strategy is when both parent and child classes belong to inheritance trees. E.g. CHILD HIERARCHY (one table per class hierarchy) Row --> abstract base class with (id, description, quantity) InvoiceRow --> subclass with "price" bigdecimal field ReturnRow --> subclass with "reason" string field PARENT HIERARCHY (one table per class hierarchy) Document --> abstract base ...

37. Limiting the children in a relationship    forum.hibernate.org

I am sure there has to be a pattern for this, but I have had no luck looking for it. Assume a one to many relationship from A to B. Assume A has an attribute called capacity. I want to ensure that A had no more instances of B that the attribute A.capacity. If I check in memory, I have a ...

38. Parent/Child/Grandchild Relationship    forum.hibernate.org

Could someone take a brief moment and outline how to properly annotation three classes where you have a parent, child and grandchild relationship. The parent contains a list of children while the children contain a list of grandchildren objects. The child and grandchild objects use a composite key where the child is a combination of a sequence and the parent id ...

41. Mapping a one-to-many relationship.    forum.hibernate.org

I have the following two database tables: Create Cached Table Users ( Id Integer Generated By Default as Identity (Start With 1, Increment By 1) Primary Key, Username VarChar(16) Default '' Not Null ); Create Cached Table UserLogins ( Id Integer Generated By Default as Identity (Start With 1, Increment By 1) Primary Key, UserId Integer Default 0 Not Null, LoginTimestamp ...

42. Hibernate Parent Child Relationship    forum.hibernate.org

Hi, I have a parent table Parent which has many to many mapping with the Child table and I also have the Parent_Child table that stores the parent_id and child_id following is the hibernate mapping defined. When I ...

43. Continued problems with parent-child relationships    forum.hibernate.org

OKay, I am still struggling with the problem of persisting a parent and the child is not being persisted. I have read Chapter 8 of the docs dealing with Parent Child Relationships (like 4 times!), and in fact I am trying to execute the exact example illustrated in that chapter. I am not having much success, however. Hibernate.cfg.xml

44. Parent-children relationship implementation question    forum.hibernate.org

Hi Everyone, I need to implement parent-child relationship and I have a question. According the Parent Child Relationship documentation, every time the application add/update/delete the child, the application requires to update the parent too (just the object not the database). I have to design a heavy transaction process and all this process will do is insert/update/delete either the parent or child ...

45. parent-child relationship within the same class    forum.hibernate.org

This is a parent/child bidirectional relationship for nested Groups: Code:

46. Problem with Parent/child relationship    forum.hibernate.org

Hi all ! I'am using Hibernate 2.0 with PostgreSQL 7.3.2 I have 2 entity: User and Account. And i modeling Parent/Child relationship between Account(Parent) and User(Child) , as described in Hibernate Reference Manual. I'am using List (and ... mapping) for Users in Account, and when i saved Account with Users, hibernate doesn't store ListIndex for Users (it's table column remains =null ...

47. Map implicit relationship?    forum.hibernate.org

I'm mapping a legacy DB which has an implicit relationship between two tables. This can of course be handled at the application level but I would love to create a hibernate mapping if possible. Its a many-to-one or zero association. Let's say from M to OZ. OZs primary key is a value, say REF in M that will never be null. ...

48. Mapping relationships... again    forum.hibernate.org

I can understand relationships between entities (and classes) easily from a DDL or a UML diagram. But Hibernate confuses me totally. I've tried generating various DDL's but when I think I understand, I get stuck again. Could someone explain how to realize the following in Hibernate mapping files? I'd like an explanation on these cases with and without bi-directionality as well. ...

49. Mapping two levels of to-many relationships?    forum.hibernate.org

I have a model where three tables are related two levels of two-many relationships. member recipient event These are garden variety to-many relationships based on a foreign key of the parent in the child, and I have a working mapping of this in hibernate. Member.getRecipients():Set Recipient.getEvents():Set Does hibernate provide a facility to map a lazy collection of Events directly ...

50. Delicate multiple parent-child relationship situation    forum.hibernate.org

Hi all. Being a beginner I've ran into a rather delicate situation I simply can't set straight. Using PostgreSQL 7.3 tables looking like this: -- Nested categories, one parent <-> many children CREATE TABLE Categories ( id SERIAL PRIMARY KEY, name VARCHAR (32) NOT NULL, parent INTEGER ); ALTER TABLE ADD CONSTRAINT Category_p_FK FOREIGN KEY (parent) REFERENCES Category (id); ...

51. Problem on Parent Child relationship    forum.hibernate.org

Dear Sir/Madam, I have a database schema with one table assoicate with another table. Thus, I use the Parent and Child relationship according to the document stated in which Parent has a Collection Set of child. It worked fine in select statement. For Business requirement, the pk for both value must be application assigned. Thus, my pk generated is used "assigned" ...

52. Problem with parent/child relationship    forum.hibernate.org

53. Parent/Child Relationships    forum.hibernate.org

Hello: I 'm still working with the lists,now bags ,but i have a problem with the Parent/Child Relationships. This is the problem: and the application throws the followong exception ----------- SEVERE: ...

54. Parent and child relationship problem    forum.hibernate.org

Author Message inoel131081 Post subject: Parent and child relationship problem Posted: Mon Feb 02, 2004 9:28 am Beginner Joined: Sun Dec 21, 2003 9:18 pm Posts: 21 Okay I have read the forum,article,tutorial, documentation and nothing works. So pleazzzzz somebody help me :( Okay basically i have to table : 1. Forum table Code: CREATE TABLE `tbl_opdg_forum` ( ...

55. Parent child relationship    forum.hibernate.org

I refer to my old posting http://forum.hibernate.org/viewtopic.php?t=927600&highlight=. I traced the error into hibernate codes. Here is my findings: When the session is flushed, in SessionImpl.private void flushEverything() It try to invoke my TopicAccessBean using BasicPropertyAccessor. But for some reason the BasicPropertyAccessor is making these calles: net.sf.hibernate.property.BasicPropertyAccessor - METHOD INVOKES BY THE GET () IS getId CLASS java.lang.Integer 37043 [tcp-connection-5] ERROR net.sf.hibernate.property.BasicPropertyAccessor ...

56. about parent-children relationship    forum.hibernate.org

Hi, I have a parent class P which is associated with one-to-many relationship with a children class C (children on the many side) Here are the partial class P and class C codes Code: public class P implements Serializable { private int PID; private Set thechildrens; public getPID() { ...

57. Inheritance and One-One relationship getting StackOverflow:    forum.hibernate.org

Newbie Joined: Thu Mar 04, 2004 1:38 pm Posts: 1 Hi, I'm pretty new to hibernate and just playing around and making some tests. So far - slim but pretty mighty. Congratulation really a good tool. I have never moved on so fast in testing a new tool and getting quick results. My Environment: Eclipse, Hypersonic, Ant+XDoclet and of course hibernate ...

58. one-to-many relationship mapping that works?    forum.hibernate.org

Is there any way in Hibernate 2.1.2 to map a one-to-many relationship (Provider-to-Service) in a such way, that I can retrieve a Collection (Set, List, whatever) with SQL like... SELECT provider.services FROM Provider provider WHERE provider.providerid= :providerid ... if Service table has neither id column, no a single primary key column, but has instead a uniquie index on four columns? All ...

59. Question on multi-tier relationship mapping    forum.hibernate.org

Hi, After scratching my head for hours, may be someone out there have already done similar stuff - any advice is appreciated. I have persistent objects Entity1 and Entity2 (in the actual app, there are even "Entity10"). Both of them contain a list of enitity "Attachment": abstract Class AbstractEntity{ private id; ... } Class Entity1 extends AbstractEntity{ private Set attachments; } ...

60. A Basic Quesion on Mapping relationships    forum.hibernate.org

Hi, I have two tables in Oracle9i Database. One is parent and the other is child. The table schema is as follows. Award ------- award_id number(14) (P.K) scheme_code varchar2(15) student_id number(14) school_code varchar2(10) award_start_date date award_end_date date provisional_ind char(1) version_no number(6) AwardStatus -------------- award_id number(14) (P.K) status_code varchar2(10) status_date date version_no number(6) Relationship is One-to-Many and Many-to-one. I mean One Award ...

61. Strange Problem with Parent Child relationships    forum.hibernate.org

Hello folks, In a parent child relationship Parent ==== Parent_Id Child === Child_Id Parent_Id Another_Id In the parent hbm I define a of child objects and in child hbm I have a relationship with parent and not-null = "true". Now I get the set from the parent domain object that contains objects of the child class. I do some ...

62. Simple Java relationship mapping    forum.hibernate.org

Hi All, I have tried reading up on this everywhere possible, but I still dont see a "simple example" of this anywhere....spent 2 days on this, so now I'm turning to u guys for help. Here is simply what I wanna do : - I have 2 classes - Candidate and Skill - Candidate contains a relation to Skill : public ...

63. many-to-any in parent child relationship with changing paren    forum.hibernate.org

Hi, I'd like to have your opinion on the solution to the following problem with Hibernate : What we want basically is a parent/child relationship model with bidirectional one-to-one and one-to-many, much like in the example provided in the hibernate docs. We use a table per concrete class strategy. Our problem however, is we don't know what is going to be ...

64. How do I map an indirect relationship?    forum.hibernate.org

65. Best Practice - Parent Child Relationship of Class w/Itself    forum.hibernate.org

I have an object MyClass, which has a many to many relationship with itself. Thus it has methods: public Myclass getParent() and public Set getChildren() which returns a Set of MyClass objects. What is the best practice for loading the entire tree of MyClass objects? Is it best to set lazy initialization to false for getChildren and run: "select myclass from ...

66. Mapping a one-to-one relationship with a where clause    forum.hibernate.org

I have a relatioship that in the db (oracle9) is a one-to-many, but in the domain layer needs to be one-to-one. We have counties and populations, a county can have multiple population based on the source, but the application I'm working on, only uses one of the sources. Here's the my initial mapping: Code:

67. parent and only child relationship    forum.hibernate.org

What is the best way to model a parent-child relationship where there can only be one child per parent? Additionally, the parent and child are the same class. I would rather avoid using a collection to hold the children if possible, and it would be nice to have a bidrectional relationship, although if that is difficult, then I would have the ...

68. Is it necessary to map relationships on both sides?    forum.hibernate.org

Given the following tables: User ---------- userId (PK) userName roleId (FK) Role ---------- roleId (PK) roleName When using middlegen, I found that it generates the following classes: User ---------- long userId String userName Role role Role ---------- long roleId String roleName Set users Is there a reason why the "Role" class maintains a Set of users or is this an unnecessary ...

69. How to mapping such relationship    forum.hibernate.org

70. Parent-Child Relationship implementation    forum.hibernate.org

Hi, I would like to know the implementation for the following scenario. Creating parent dynamically in the database and attach the children. I have found the following code in hibernate site. Here, parent is already created and the child link is attached to it. But , my case is parent should be created in the database dynamically and then child needs ...

71. Parent-Child Relationship implementation    forum.hibernate.org

Hi, I would like to know the implementation for the following scenario. Creating parent dynamically in the database and attach the children. I have found the following code in hibernate site. Here, parent is already created and the child link is attached to it. But , my case is parent should be created in the database dynamically and then child needs ...

72. No Relationship Mapping in Hibernate    forum.hibernate.org

Hi All, Is it feasible to have a web-application where only the INSERT, UPDATE and DELETE database operations will use hibernate? I am planning to use direct JDBC for my SELECT because I dont have relationship mappings in hibernate (but I do have relationships in my database - SQL Server 2000). Can this be a feasible solution? I only have a ...

73. Lesson learnt with Parent / Child relationship    forum.hibernate.org

Hi all, I have just started using Hibernate and after reading some of this forum, I found myself in the boat of having trouble getting my first parent /child relationship working. The scenario is two tables with natively generated keys with a one - to - many relationship between parent and child. After reading chapter 16 of the manual I tried ...

75. Question about query the parent / child relationship    forum.hibernate.org

Newbie Joined: Sun Sep 26, 2004 8:56 am Posts: 3 Hibernate version: 2.1.6 Mapping documents: ...

76. Problem with Parent Child Relationship    forum.hibernate.org

Hi Guru's I am trying to deal with parentchild relationship in database through Hibernate. I have tried the code given in the reference doc.But it seems it is not working. Parent p=(Parent) session.load(Parent.class, pid); Child c = new Child(); p.getChildren().add(c); session.save(c); session.flush(); The document says : Hibernate would issue two SQL statements:

77. Best practice for mapping a one-to-zero-or-one relationship    forum.hibernate.org

f your B->C mapping is mandatory (constrainted=true), Hibernate will use proxy for C resulting in lazy initialization. But if you allow B without C, Hibernate just HAS TO check presence of C at the moment it loads B. But a SELECT to check presence is just inefficient because the same SELECT may not just check presence, but load entire object. So ...

78. Loosely Coupled Parent - Child Relationship    forum.hibernate.org

Hi all, Using the examples in the documentation I can easily create a parent/child realtionship with Hibernate (in my case it's an album that has many photos). No problem. However, in all the examples the parent and/or the child have an explicit knowledge of each other, e.g. the parent Java object has a property for the child. I would like to ...

79. Loosely Coupled Parent - Child Relationship    forum.hibernate.org

Hi all, Using the examples in the documentation I can easily create a parent/child realtionship with Hibernate (in my case it's an album that has many photos). No problem. However, in all the examples the parent and/or the child have an explicit knowledge of each other, e.g. the parent Java object has a property for the child. I would like to ...

80. Problem with optional children in parent/child relationship    forum.hibernate.org

I'm having trouble implementing an optional association between entities. I have a Customer object with an optional billing Address object. Due to issues with our view technology, the optional child entity - the Address object, in this case - cannot be null. My first thought was to instantiate an empty Address object in the constructor for the Customer object. The problem ...

81. use set represent parent/child relationship    forum.hibernate.org

Hi, I am newbie,one problem always bothers my head recently,that is using set tag represent parent/child relationship. before use set tag i always used bag tag, it worked fine,but effect was not good. so i decide to use set tag to represent parent/child relationship for effect. but the result is not what i expected,can anybody tell me what my miss is? ...

82. Another simple problem of Parent/child relationship :)    forum.hibernate.org

I m using a simple relationship of a parent and a child. The child is "Biographie" and the parent is "Auteur". When i want to update my parent, i got : java.sql.SQLException: Cannot insert the value NULL into column 'Auteur_ID', table 'HetCJacques.dbo.Biographie'; column does not allow nulls. INSERT fails. Auteur_Id is the foreign key of my parent on the table of ...

83. Newbie problem with mapping relationship    forum.hibernate.org

Newbie Joined: Thu Dec 09, 2004 10:48 pm Posts: 5 I think that my problem is a simple matter of me, as a newbie, getting some concepts reversed. It looks to me like I am missing something that is supposed to be very obvious. The symptom I have is that when I attempt to retrieve an object that has a collection ...

84. Parent-Child relationship - revisited.    forum.hibernate.org

Say, I have a parent-child type of table relationship, say, Cat and Kitten. How will I define the XML mapping or the class definition in such a way that when I load the Cat info from the database, it will load only Kittens with, like, red noses? Like this, Code: Cat c = (Cat)query.createNamedQuery( "from Cat where name = 'lovella'" ...

85. Mapping a parent/child identifying relationship    forum.hibernate.org

86. map relationship    forum.hibernate.org

I'm trying to use a map relationship that has a database setup that is a bit different than all examples that I have seen. Parent Table SBT_BGT_STRGRP_HRS (see mapping document for details) has a composite id of two ints. One of these ints is a foreign key to the child table. Child Table SBT_OPER_HRS_NM key = foreign key from parent table ...

87. Can I map this relationship in Hibernate?    forum.hibernate.org

Hibernate version: 2 I have a table that relates to either one of 2 other tables. There is a column in the table that indicates which one of the two to relate to. For example. I have 3 tables: Table1 Table2 Table3 Table 1 contains a column called relateTo which contains one of the following two values: Table2 Table3 The column ...

88. Bottom-up Mapping for a Hierarchical Entity Relationship    forum.hibernate.org

Hello, and thanks in advance for your time and assistance... Synposis: * Need a mapping for a hierarchical (recursive) relationship. - Using hibernate 2. - Hand-mapping the relationships absent from Middlegen-generated hbm's for an existing database. Details: The database schema tries to model a hierarchical relationship with a link table whose two columns are the parent and child id's, respectively. These ...

89. Creating a Map with many-to-many relationships    forum.hibernate.org

Hi, I have the following situation: I'm using a table to store text values localized in various languages. This table is then referenced whenever a localized text value is needed in another table. For example, I have a "Category" object that needs a localized title and description: public class Category { ... Map title; Map description; }; Each Map should contain ...

90. Parent - Child - Grandchild Relationship    forum.hibernate.org

Hibernate version: 3.0.3 I have been working on this problem for a while, and for some reason I cannot seem to get it properly working properly. What I have been trying to do is have a Parent - Child - Grandchild relationship where everything is cascaded by "all-delete-orphan" up to the "Parent". That way I should only have to call the ...

91. How do i establish a forgien key relationship in the mapping    forum.hibernate.org

I have two tables with a one to many relationship linked by id. How do i establish a forgien key relationship in the mapping file. I am using Hibernate 1. Thanks Biswajit Here is my attempt: ...

92. Parent / Child relationship for single table objects    forum.hibernate.org

I am writing an application that works with Inventory. After adding the set as defined below, hibernate throws an initialization exception. I am using hibernate 3.0.3 on postgresql 8, though my real problem i fear lies in the fact that I just dont seem to be able to understand collections in hibernate. JAVA and Xml included below table design Table Parts ...

93. parent/child relationship    forum.hibernate.org

I just realized that in a 1-* relationship, hibernate does not offer many options other than what is exposed in section 22.2 of doc 3.0.3. those options would be : - a unidirectional 1-* (cf section 8.2.3 - really not recommended) - composite elements (cf section 22.5 - unfortunately, there are 2 big limitations to composite element classes ...) so in ...

94. RelationShip mapping    forum.hibernate.org

I am a Hibernate Newbie and have gone through the related documentation but could not find the solution. We have a Table A which has a one to one relation with table B. Table B has one to many relation with table C. The columns in each of the tables and the relations are as following: Table A(Class A) : id_a, ...

95. Problems with many-to-may relationship mapping    forum.hibernate.org

Author Message sinoea Post subject: Problems with many-to-may relationship mapping Posted: Mon May 23, 2005 2:07 pm Newbie Joined: Sat Apr 23, 2005 10:50 pm Posts: 17 Hi, I am having problems with many-to-many relationship mapping. Basically, I have a Menu class that has a Map collection of SalesLineItem objects. Also I have a Sale that has a Map ...

96. Parent/Child relationship on the same table    forum.hibernate.org

97. Mapping Relationships    forum.hibernate.org

Hi Guys, I have some beginners issues with mapping associations, i have reference material but still would like to get peoples thoughts. I have a table Customer_Orders, that contains order informtion I have a table Products, that lists productions available to buy. I then have a table called orders_products which contains, an order id, a product_id and product qty. When i ...

98. Indirect Relationship Mapping    forum.hibernate.org

...

99. How to Map the following relationship?    forum.hibernate.org

Newbie Joined: Fri Apr 22, 2005 8:40 am Posts: 3 Hibernate version: 3.0.5 Name and version of the database you are using:Oracle9i Hi, how can I map a bidirectional, one-to-many parent-child relationship, so that the order of the children will be preserved (we use now java.util.List collection for the children, but it can be changed) and a 'delete on cascade' constraint ...

100. Adding a Child In Parent/Child Relationship    forum.hibernate.org

jdsrinivas Post subject: Posted: Wed Sep 28, 2005 5:11 pm Beginner Joined: Tue Sep 06, 2005 5:16 pm Posts: 24 Location: USA Mapping file for parent: Code: