relation 4 « Map « JPA Q&A





1. relation in two tables    forum.hibernate.org

2. Relation one-to-many:Can i Save parent and childs automatic?    forum.hibernate.org

Newbie Joined: Tue Aug 31, 2004 9:22 am Posts: 6 If i have a realtion one-to-many into de class One and ManyObject, and I create a One object like this: One one= new One(); one.setMany(new ArrayList()); for (int i = 0; i < 3; i++) one.getMany().add(new ManyObject()); Then,if i do this: Session session = this.getSession(); tx = session.beginTransaction(); session.save(one); tx.commit(); Then ...

3. one-to-one relation between two sub class in table?    forum.hibernate.org

I want to implement this,two discriminator subclass,there is a one-to-one relation between two subclass,but It is a legacy schema,two subclass is in one table. In detail, Hibernate version:2.1.6

4. many-to-one relation logic    forum.hibernate.org

5. M:N relation extra field in this table    forum.hibernate.org

6. how to map a denormalized parent child relation?    forum.hibernate.org

Thanks Michael, that's a good idea. I tried it with Oracle and it does exactly what I want it to do. I'v to support Sybase as well. After checking the docs, I think Sybase cannot have triggers on views :-(. Their's no direct way of mapping the denormalized table to parent-child classes? TIA Ernst

7. object / table relation update problem    forum.hibernate.org

yes i use bidirectional assosiations. a bidirectional many2many from contact to receiverlist. and we would like to get, that if i delete a contact, this should be deleted in all receiverlists. but not inverse. logicaly:-) do you need some more infos? here some code: contact.hbm.xml: ... ...

8. many-to-many relation ?    forum.hibernate.org

9. How to map this one-to-one relation to Hibernate    forum.hibernate.org

Hi, I've got to make the Hibernate mapping for an existing Oracle DB schema. It contains a one-to-one relationship between the instances of the same type, however it's been done the way many-to-many relations are: There's a table for the entity instances, let's call it ENTITY, it has an id field and several property fields. There's another table called ENTITY_REL which ...





10. HQL and many-to-many relations    forum.hibernate.org

sorry, but my post was submited without finishing (firefox strange behavior) The mapping for Customer is: ...

11. Collection or relation many-to-one    forum.hibernate.org

Hi everyone, I don't really know when I should use a many-to-one relationship or a mapping with a Collection. Let's assume one has two classes Parent and Child. Could you explain to me, in what case(s) one should implement the solution 1 or the solution 2 Solution 1 (a Collection - as in the Hibernate Reference) Code: public class Parent { ...

13. How to have One to many relation??    forum.hibernate.org

Hi all, I have a class that is going to contain another class (B) instances. Consider the example below class A{ List bs; //List containing objects of class B //and i have getter and setter methods for this attribute } Class B{ String a; //get and set methods } So if I say session.save(A) does it save the Bs instances also ...

14. How to update the relation table describe in a set collectio    forum.hibernate.org

I Nico I'm french so may be my english is not perfect; However, i'm trying to expose you my Problem. First let me present you one of the part of my Database. There are two main tables which are a primary key: TTACHE_EXT ID_TACHE Varchar(20) PK NOMFIC VARCHAR(50) The first one TANNUAIRISTE ID_ANNUAIRISTE Varchar(20) PK NOM VARCHAR(50) The second one TTACHE_ANNU ...

15. many-to-many relation doesn't poplulate association table    forum.hibernate.org

olambert Post subject: Posted: Wed Dec 08, 2004 4:41 am Newbie Joined: Thu Dec 02, 2004 10:56 am Posts: 3 Location: Belgium It does not work. Here is the log : DEBUG *** 08/12/2004 09:30:58,642 *** [main] (Cascades.java:497) *** processing cascades for: be.smalsmvm.spi.tools.report.bo.Project DEBUG *** 08/12/2004 09:30:58,658 *** [main] (Cascades.java:524) *** cascading to collection: be.smalsmvm.spi.tools.report.bo.Project.subProjects DEBUG *** 08/12/2004 09:30:58,658 ...

16. one-to-many relation    forum.hibernate.org

Hi got a question. I want to make a one-to-many relationship between two tables/classes Class1 got: id =(native generated id) listnumber = (Long) Class2 got id =(native generated id) listnumber = (Long) In class two I want a function: public Set getClass1() that will return all entries (or instances) of Class1, To be more specific: an instance Class2 has for example ...





17. n:m relations    forum.hibernate.org

Hello! I have a problem with hibernate. I would like to implement many-to-many relation of 2 db-tables with the help of hibernate.. I have tried a lot of things out, but i didnt succeed. I have following tables defined in my database: CREATE TABLE `companies` ( `Id` int(6) unsigned NOT NULL auto_increment, .... ..... ..... `description` text, `changeDate` datetime default NULL, ...

18. many-to-many relations    forum.hibernate.org

private Set univers; /** * * @return * * @hibernate.set * cascade="all" * inverse="true" * table="MTM_UnivSple_ReunionDUniv" * @hibernate.collection-many-to-many * class="com.iaf.frontalbv.om.UniversSimple" * @hibernate.collection-key ...

19. many-to-many reflexive relation    forum.hibernate.org

20. Is Hibernate supports Unary relations    forum.hibernate.org

I have 2 class 1. Employee empId,name,managerId 2.Project projId,projectName In that Employee class , managerId is the references of Employee(empId) I wants to create many-to-one bidirectional relationship navigation. with the navigaton names as manager,managedEmployees i dont know how to do create mappings & also create the client code which is having CRUD operations can you pls help me out. i am ...

21. one-to-many relation    forum.hibernate.org

I use the example from hibernate document. Here is mapping from document and I add one more line for "otherId" property. .... The one-to-many relation is equivalent to: select children from TBL_child as c where c.parent_id = id; The last "id" after ...

22. Exception when saving objects with many-to-many relation    forum.hibernate.org

Hibernate version: 2.1.7 I have a strange exception with a many-to-many mapping when saving my objects. I have a user class with a list of projects and and project class with a list of users. Mapping documents: Project:

23. one-to-one relation with subclass.    forum.hibernate.org

Beginner Joined: Tue May 11, 2004 10:40 am Posts: 37 Location: Belgium Thanks for your response, but I allready tried to solve it with a many-to-one mapping, but Hibernate still gives the following error: Code: 16:50:27,375 ERROR JDBCExceptionReporter:58 - Referential Integrity Violation. ADVENTUREBUILDER.RULE references ADVENTUREBUILDER.OPERATION 16:50:27,375 ERROR SessionImpl:2399 - Could not synchronize database state with session net.sf.hibernate.exception.GenericJDBCException: could not insert: [syntaxtree.Rule#1] ...

24. Pagination in one-to-many relations    forum.hibernate.org

25. No cascade insert to one-to-one relation    forum.hibernate.org

Hi, I have two tables: Subscriber and Profile Subscriber is a child of User, persisted in a single table. Each subscriber has max one profile. I have mapeed the profile as a foreign key association. However, when I create a new subscriber with an emtpy profile, the profile doesn't get inserted. On another note, why do I need to have two ...

26. is it a relation between lazy=true and my exception ???    forum.hibernate.org

Author Message thomasFranck Post subject: is it a relation between lazy=true and my exception ??? Posted: Thu Jan 13, 2005 6:18 am Newbie Joined: Tue Jan 11, 2005 10:56 am Posts: 6 Sorry it's already me, but I'm lost, I don't understand this exception !!! Hibernate version: 2.1.6 Full stack trace of any exception that occurs: SEVERE: org.springframework.orm.hibernate.HibernateSystemException: Found ...

27. Basic relation question    forum.hibernate.org

Hi, I have big problems with understanding the one-to-many relation. For example, if a parent has 3 childeren: Parent 1 |- child 1 |- child 2 |- child 3 I have the following java code. Collection childeren = parent.getChilderen(); // works fine. But how I remove child 3, and change the age of child 1 Also how can I sort them ...

28. Removing elements from a one-to-many set relation fails FK    forum.hibernate.org

Newbie Joined: Fri Jan 14, 2005 12:36 am Posts: 3 I am trying to remove a child value from a set on a parent object. I have set the cascade attribute to all-delete-orphan, so this should cause a deletion of the child object However, it looks like the SQL being generate is attempting to update the foreign key value to NULL ...

29. removing link in many-to-many relations    forum.hibernate.org

Mapping documents:

30. Bug? Subclass one-to-one relation not persisted    forum.hibernate.org

Sounds to me like you've got your unsaved value set wrong. Hibernate needs to know what the unsaved value of your primary key and/or version is. For example, if you use a "long" primary key, it needs to know if -1 or zero or whatever is the "unsaved value" of the object. Does your class use a primitive "long" or an ...

31. Relation m:n and inheritance    forum.hibernate.org

Hello Guys I have the following problem: I have three classes class a, class b and c. class b and class c extends class a so I have b(a) and c(a)... (superclass) I want to persistand the class b and class c that is no Problem. But in class a There are two lists: parents and childs. In each list are ...

32. Relation objects    forum.hibernate.org

Hi, If we have two classes that one contains another like Public class A{ B } what is the best approch for inserting A B foundedB = findByPk("an id of object b"); a.setB (foundedB) insert(a) OR B b=new B(); b.setId("an id of object b"); a.setB (foundedB) insert(a) As you found in first approch we find b object and then set it ...

33. How to map a (DB or Entity Relation) Subtype right?    forum.hibernate.org

http://www.hibernate.org/ForumMailingli ... AskForHelp read and understand! Hibernate version: 2.1.7 Name and version of the database you are using: Oracle 9iR2 Hello hibernate team, I guess my former post was a bit unprecise/unclear ... therefore I'll give it a second chance/try: I have the following legacy database model: Table Object_States ( object_id number -- primary key ... ) Table Person ( person_id ...

34. Relation many-to-one + cascade="delete"    forum.hibernate.org

public class Town extends BaseObject implements Serializable { protected String name; protected Country country; /** * @hibernate.many-to-one * column="FK_COUNTRY_ID" * class="org.appfuse.model.Country" * ...

35. many-to-many relation, count(*) query    forum.hibernate.org

Hello! I have a question. I have two entities, say, item and shop, in a many-to-many relation. Let's assume shop A sells items 1, 2, 3 but not 4. While shop B sells items 2, 3, 4 but not 1. Entity Shop has a set of Items, and Item has a set of Shops as property. Now I want to query ...

36. Wrong SQL generated when finding null 1:1 fk relations    forum.hibernate.org

I have an Application object that has a one-to-one relationship with a queue. The database is set up so that queue has the key of applciation on it as a foreign key. I want to find a count of all applications without a queue. My HQL is this: select new net.targetgroup.broker.queue.QueueCount(count(*),sum(application.advance)) from net.targetgroup.broker.application.Application as application where application.queueEntry is null but this ...

37. maintaing relations with multiple tables dynamically    forum.hibernate.org

Hi All, In my application I have User, Group and Role objects. The roles can be associated with either User or Group. I have corresponding classes and tables. So I am maintaining a table called ROLE_MAP. In that table I am storing ENTITY_TYPE, ENTITY_ID and ROLE_ID. Here, ENTITY_TYPE is either "U" (U for user) or "G" (G for group). ENTITY_ID is ...

38. Good usage of bidirectionnal relations ?    forum.hibernate.org

39. 0 to 1 relation    forum.hibernate.org

Hi, how map a unidirectionnal '0 to 1' relation between 2 classes ? I have one class A which can have (or not) an instance of B. So i have, 2 tables: A et B, and B have a foreign key from A. But i don't understand how map this model in hibernate (one-to-one, many-to-one with unique contraint ?) Regards,

40. Bad performance in M:M relation with java.util.Set    forum.hibernate.org

Hi! Using Hibernate 2.1 with latest versions of XDoclet and HSQLDB. I have a M:M relation between two tables; statistics_tbl (mapped as StatisticsBean) and test_tbl (TestBean). The TestBean adds statistics (using a java.util.Set with lazy invokation). Like: new TestBean().addStatistics(new StatisticsBean()); Now, it seems like all instances belonging to a perticular testBean are beeing created each time new statistics are beeing added ...

41. Parent Child relations    forum.hibernate.org

I have two classes Subject Question Question.hbm.xml Subject.hbm.xml

42. Many-to-many relation with extra properties    forum.hibernate.org

Read the rules before posting! http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.0 beta 4 Mapping documents: Code: ...

43. Trouble understanding relation    forum.hibernate.org

Newbie Joined: Mon Feb 28, 2005 11:09 am Posts: 7 Hi, im in serious trouble understanding the one-to-one relationship in Hibernate. Ive got two simple tables like this: Code: _____________ __________ | | ...

44. Non-Mandatory property for a many-to-many relation    forum.hibernate.org

Dears, I have some attributes on a many-to-many relation (viewDate), so I am using composite in my set. But, as you see in the following, the attribute(viewDate) is not mandatory! so, it is null when, we create it. But, when I am updating this set, It can not delete the related old row, therfore I get a duplicate error (I have ...

45. Many-Many Relation- uni directional    forum.hibernate.org

46. can i get the relation between tables    forum.hibernate.org

hii thank you for ur suggest but i tryed alot but can't get any thing . i will descrip my case and please help me if you can i have to table A and B suppose i have one colom in every one A_id primary key of A and .B has foriegn key from A is A_Id my case is to ...

47. Ternary Relation Problem    forum.hibernate.org

Hi, i've a problem with realize ternary relation... I use a very simple example for explain my problem: DB is composed of four table: - users (userId,name) - groups (groupId,description) - role (roleId,description) - u_g_r (fk_userId,fk_groupId,fk_roleId) my problem is that i would have a method on Group class that return the users of this group and theyr role (only roleId that ...

48. I am not able to update a many-to-many relation ship    forum.hibernate.org

Hi all , this is the code I am using and I am not able to update the BOMDEFN table...please help I am new to Hibernate. thanks ----------------------------------------------------------------------------- ContentObject contentObj = (ContentObject)getHibernateTemplate().load(ContentObject.class, contentObjectOid); BOMDefn bd = (BOMDefn)getHibernateTemplate().load(BOMDefn.class, new Long("0")); contentObj.getBoms().add(bd); getHibernateTemplate().save(contentObj); ---------------------------------------------------------------------------- these are the mappings Content_Object_Seq

49. Simple 1-to-n relation    forum.hibernate.org

Hi, I want to create a simple 1-to-n relation, which is not bidirectional. So I want to be able to the get the 1-side from the n-side, but not the other way round. As an example, I have a table of countries, and a table of addresses. Each address references a country. I want to easily access the country information from ...

50. Persisting many-to-many relation    forum.hibernate.org

Newbie Joined: Tue Mar 01, 2005 7:10 am Posts: 1 Read the rules before posting! http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.0 Mapping documents: Code:

51. how to map table relation not using foreign key?    forum.hibernate.org

CREATE TABLE tab1 ( pk1 INTEGER NOT NULL PRIMARY KEY, ref1 INTEGER NOT NULL UNIQUE, ... ); CREATE TABLE tab2 ( pk1 INTEGER NOT NULL (REFERENCES tab3 <- maybe irrelevant for this problem), pk2 INTEGER NOT NULL, ...

53. how to describe the unusual many-to-many relation?    forum.hibernate.org

A user table mapping to a typesafe enum, a user can has more than one roles, and of course one role can assigned to more than one users. for example: the user table has 2 fields (login_id, pwd), so the hibernate class is like: Code: public class user{ private String loginId; private String ...

54. relation with property?    forum.hibernate.org

Let's start by setting up relationships between classes such as User, Roles Class User contains email:String password:String Class Role contians name:String descripition:String Both the classes USER associated with Roles. A many-to-many relationship exists between Users and Roles (that is, association with independent lifecycles). User associated with roles Many-to-many Association Unidirectional (Users-->Roles) [User.java] /** * @return * @hibernate.bag * table="TBL_JOIN_USER_ROLE" * cascade="all" ...

55. Projections.projectionList() relation many-to-one don't work    forum.hibernate.org

Author Message b.devis@witboy.com Post subject: Projections.projectionList() relation many-to-one don't work Posted: Thu May 05, 2005 12:27 pm Regular Joined: Thu Feb 24, 2005 2:34 pm Posts: 80 Hibernate version:3rc1 Hi, i'm trying to use criteria in this way Criteria crit = session.createCriteria(CVenditaVO.class) .createAlias("modevo", "r") .setProjection(Projections.projectionList() .add(Projections.property("r.cmpfmo.cdc_cmpf")) .add(Projections.property("r.cmpfmo.dsc_cmpf")) .add(Projections.property("modedi")) ) .add(Restrictions.eq("pk.shopdi", shop)) .add(Restrictions.eq("pk.datadi", data)); but hibernate throws could not resolve ...

56. Update before delete in relation one-to-many    forum.hibernate.org

57. Too many statements (one to one relation)    forum.hibernate.org

Hi I have a big perfomance problem with hibernate... simple example with 3 tables. the tables synonym and mofisPerson reference person with one to one relationships: Synonom 1<--1 Person 1-->1 Mofisperson if i try to search a person hibernates creates several statements for each record (!) that matches the query. If you have a look at the data below you see ...

58. is it possible to define a relation between two join tables?    forum.hibernate.org

Newbie Joined: Fri May 20, 2005 2:42 am Posts: 14 Hibernate version:3.0.5 Mapping documents: Code: ...

59. Query Problem: relation "xyz" does not exist    forum.hibernate.org

Author Message youraveragejoe Post subject: Query Problem: relation "xyz" does not exist Posted: Thu Jun 09, 2005 10:08 am Newbie Joined: Thu Jun 09, 2005 9:53 am Posts: 6 I have a table in Postgres as follows: Code: CREATE TABLE "DrugName" ( "drugNameID" int8 NOT NULL DEFAULT nextval('public."DrugName_drugNameID_seq"'::text), "drugName" varchar(100) NOT NULL, CONSTRAINT ...

60. how to define such relation? one to ( zero or one )    forum.hibernate.org

I have such a model : Case <----> Charge 1 0..1 that is , a 'Case' may have a 'Charge', and can have at most one 'Charge'. andn a 'Charge' can belong to only one 'Case'. Both case and charge are entities ( they have actual database tables). Relation from charge to case may be defined as one-to-one (). but what ...

61. how to pass partition hints to hibernate relation methods    forum.hibernate.org

Hibernate 3.0.5 How do i pass partition keys to related methods. I have BUSINESS_ID on all my tables and i partition my oracle database based on business_id column. In most of my queries I pass the BUSINESS_ID as my parameter but if an object has a relationship with some other object say a User Object has a 1-->n relationship with a ...

62. problem of comprehension relation many-to-many    forum.hibernate.org

Hello, I do not manage to fill out my table associated with 2 classes in relation many-to-many. Here are what I do but I perhaps understood of through Agent.hbm Code: ...

63. Reverse relation of a association    forum.hibernate.org

64. Problem with a one-to-one relation    forum.hibernate.org

When I tryed: In initialization I obtained. Caused by: org.xml.sax.SAXParseException: Attribute "unique" must be declared for element type "one-to-one". And doing I obtain the same that before. org.springframework.dao.DataIntegrityViolationException: (HibernateTemplate): data integrity violated by SQL 'null'; nested exception is java.sql.BatchUpdateException: ORA-01400: cannot insert NULL into ("FORMUWEB"."ANWERS"."IDCONTACT") The attribute foreign-key what is ...

65. hibernate v3 - middlegen - implicit relation problems    forum.hibernate.org

I am currently trying to build a new Java application on top of an already existing database which cannot be modified, because an old application is working with it. The database contains a major design problems: Relations are implicit; this means we have quite many relations between the tables, but these are not defined as FOREIGN KEY. So the application must ...

66. HQL Question about querying via relation    forum.hibernate.org

I have a user object with a one-to-one mapping to another object. I know the id of that other object, and I want to load the appropriate user. It is a unidirectional relation from the user to the other object, so I can't load the child object by id and then do a getUser() on it, not that I'm interested in ...

67. problem with collection persistence in many-to-many relation    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 2.1.6 Mapping documents: Persona.hbm.xml, Privilegio.hbm.xml Code:

68. relation ship problem :transientInstance exception, ver 3.0    forum.hibernate.org

hi, I have following relation ship Contact has one -many relation ship with ContactAddress I have specified it in Contact.hbm.xml ContactAddress has many - one relation ship with Address. When I try to save Contact I get an exception transientInstance exception for Address and it says save the Address first Isnt automatically handled by hibernate, Please let me know if I ...

70. hb 3.0.4: mant-to-one relation violates db constraint    forum.hibernate.org

... ... ...

71. Question in hibernate one to many relation.    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version:3.05 I am now working on a legacy database(MS SQLSERVER 2000). I have two tables, They are one-to-many relation. CREATE TABLE [FSICOLUMNSETTING] ( [OBJECTID] [int] NOT NULL , [CLASSID] [int] NOT NULL , [NAME] [varchar] (255) NULL , [DESCRIPTION] [varchar] (255) NULL , [CREATED] [datetime] NULL , [LASTMODIFIED] [datetime] NULL ...

72. Many-to-Many relation with properties    forum.hibernate.org

73. fake foreign key relation breaks when data doesnt support it    forum.hibernate.org

Author Message dnewman3131 Post subject: fake foreign key relation breaks when data doesnt support it Posted: Mon Sep 12, 2005 5:28 pm Newbie Joined: Wed Sep 07, 2005 5:15 pm Posts: 12 Hi everyone, I am hoping someone can solve this huge problem of mine. I am getting a Hibernate Exception No row with the given identifier exists: [com.dao.IdmsScheduleTable#58800] ...

74. ERROR: relation "scheme.tableName" does not exist    forum.hibernate.org

I'm getting this error when trying to insert data to a table: Code: WARNING: SQL Error: 0, SQLState: 42P01 20/09/2005 11:24:22 net.sf.hibernate.util.JDBCExceptionReporter logExceptions SEVERE: ERROR: relation "quant.concurso" does not exist The problem is that when I retrieve or delete data from this very same table it works perfectly! So I believe its hbm.xml file is correct, otherwise retrieving and deleting data ...

75. Need help for configuring many-to-many map relation type?    forum.hibernate.org

My hibernate version is 3.0.3 SUN JDK 1.4.2 Oracle 8.1.7 Windows XP, What I want to do is to use a non primary key property as the map key in a many-to-many relations with using collection table. In our scenario, a Company can have many different types of Phone, such as main contact phone, fax number, and so on. Meanwhile, Company ...

76. Error: Insert-operation in Relation with autoincrement field    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hi, im new with Hibernate and i'm facing the following problem. I retrieve somes Data and wan to store the result in my DB. I have following relations: AttributeGroupDef(attGroupDefID, parentAttDefID, deleted, groupPosition) with self reference[Field: parentAttDefID] and AttributeDef(attDefID, attGroupDefID, active, .... attPosition). The field attGroupDefID should be autoincrement and set by ...

78. two many-to-one relations between two classes.    forum.hibernate.org

Hi, I have the following situation: there is PERSONS table with CURRENT_ADDRESSID, which is a foreign key to ADDERESSES table. ADDRESSES table has a foreign key PERSONID to PERSONS table. This foreign key has also NOT NULL constraint and FOREIGN KEY constraint. I model all these as many-to-one currentAddress relation between Person and Address, and as many-to-one "person" relation from Address ...

79. Many-to-one bidirectionnal relation to itself ?    forum.hibernate.org

Hello, I have a class with a bidirectionnal relation to itself : a category can be have several child and have one parent. Everything is fine except when I try to change the parentcategory. The category is "moved" to the new one but is not deleted from on the old one. So I get two duplicated categories... What's wrong ? Thank ...

80. mapping problem with some parent/child relations    forum.hibernate.org

Hi all, First of all, thanks in advance. I'll try to explain my problem the simplest and best I can. I'm using Hibernate 2. I have one entity: Image, that can, or not, belong to another entity: Cd (of images). I map this relation this way: ...

81. cascade=none not working with many to one relation    forum.hibernate.org

I'm using Hibernate 3.0.5 and noticed that the behaviour of cascade="none" in a many-to-one relation doesn't work the same. It seems that cascade="none" is not beeing handled in H3. I tried to download H3.1 rc2, but the result is the same. Jra pages were of no help. Here is my short example: TblDocumenti doc = (TblDocumenti)SessionManager.currentSession().load(TblDocumenti.class, new Long(506)); // set an ...

83. NonUniqueObjectException with many-to-many relation    forum.hibernate.org

Author Message elmpp Post subject: NonUniqueObjectException with many-to-many relation Posted: Wed Nov 02, 2005 8:51 am Newbie Joined: Wed Nov 02, 2005 8:13 am Posts: 4 Hi there, great product. This is probably really simple but, believe me, I've searched everywhere for an answer. I have 2 Business Objects - User and Group - each having a (Set) collection ...

84. Exception on many-to-many relation    forum.hibernate.org

Hi, I'm facing a problem with many-to-many relation, especially in the generation of the primary key for the association table. I'm quite new to hibernate and I'm experimenting with its many features... In my db I have an Order, a Product and an OrderLine tables. The OrderLine table has a composite key (orderId, productId) and two more fields, amount and price. ...

85. Saving Relation for an Immutable Entity    forum.hibernate.org

I have an Entity A which is Immutable, and an Entity B which is mutable. There is a many to many relationship defined between A and B. Now I have a collection of Entity B which I have to associate with Entity A. If I write session.update(a) where a is an instance of Entity A my relationship is not getting saved ...

86. a Map of values in a 3-table relation    forum.hibernate.org

Hi guys, i was wondering how do you map a collection of values in a 3-table relationship.. for example if you have a users table, a user_role table, and a roles table.. a user can have multiple roles. and for each role id like to know which users have that role. my mapping files are below.. and u can see what ...

87. Events triggered from cascaded/relation operations    forum.hibernate.org

Hibernate version: 3.0.5 I've checked through the reference documentation and looked briefly through the event.* api looking for something suitable but haven't been successful so far. I'm looking for an ability to capture relationship events between entities (basically adds & removes). ie) Project --> Sample If I add Sample.Y to Project.X, it would be nice to have an event triggered that ...

88. problem with one-to-many relation    forum.hibernate.org

Hi! I'm a hibernate newbie and I'm getting some strange results with a one-to-many relation, relating an object to childobjects of the same class. My one-to-many Set seems to contain only 1 object, even though I know for a fact it's supposed to contain several. If I change the Set into a List, I get all objects but the list also ...

89. Merging objects with cascade all-delete-orphans relations    forum.hibernate.org

There is a scenario when it could be useful with a "smarter" merge of cascaded collections. Here is the scenario: 1. We load an object that has a number of relations 2. Displays it on a webpage and lets the user update it. We keep the object id in the form as a hidden field. Only the main object is updated, ...

90. problem with cascade update in one-to-one relation    forum.hibernate.org

Hi, I find my bug. I create new object of UserInformation and set it to User, so Hibernate find that it have null ID, so he create new row. I had to call get method and thet change data. It was obviously my missleading. Sorry to disturb you. Thanks for repplay :) Merry Christmas :)

91. Filter on many-to-many relations    forum.hibernate.org

92. Unable to read a simple one-many relation    forum.hibernate.org

Author Message Mirza M. A. Baig Post subject: Unable to read a simple one-many relation Posted: Mon Jan 02, 2006 2:23 am Newbie Joined: Mon Jan 02, 2006 1:40 am Posts: 9 Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hi, I am trying with a very simple one-to-many relationship. When I am storing the objects, there ...

93. relation "XXX" does not exist    forum.hibernate.org

Newbie Joined: Fri Jan 13, 2006 10:14 am Posts: 4 Location: MD Hibernate version: 3.0.5 Mapping documents: IndexNavigareXX.hbm.xml Code between sessionFactory.openSession() and session.close(): Code: try { sessionFactory = new Configuration() .configure("hibernate.cfg.xml") ...

94. Relation between tables in different databases    forum.hibernate.org

Hi everybody, i want to ask if it is possible to make a mapping in hibernate of a relation from a table in a database with another table in other different database (with different sessionfactories) or i have to do with SQL (i need to maintain integrity with triggers and so on...) without using hibernate. I think that hibernate doesn't support ...

95. joined-subclass ERROR: relation "xy" does not exis    forum.hibernate.org

tpayment_id_seq ...

96. all-delete-orphan relations failed on update    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: Hibernate 3.0.5 Mapping documents: Code: ...

97. Self Referencing Relations...    forum.hibernate.org

Yeah, why should it not work? It just does not work :) Here is the query trace: select * from Message m select * from Message message0_ left outer join Message message1_ on message0_.messageOid=message1_.rootMessageOid where message0_.rootMessageOid=? org.hibernate.HibernateException: More than one row with the given identifier was found: Message@ff665a, for class: Message at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:135) at org.hibernate.loader.entity.EntityLoader.loadByUniqueKey(EntityLoader.java:85) at org.hibernate.persister.entity.AbstractEntityPersister.loadByUniqueKey(AbstractEntityPersister.java:1522) at org.hibernate.type.EntityType.loadByUniqueKey(EntityType.java:365) at org.hibernate.type.EntityType.resolve(EntityType.java:306) ...

98. how to set up computed relations?    forum.hibernate.org

I have two tables (TA and TB) that are related logically by one text field TA.ref_field. I created a Java class for each table and would like to setup a property on my class for TA that points to an instance of my java class for TB based on tb.id = substr(ta.ref_field, 1,2) ... is this possible? I've read about formulas ...

99. ClassCastException on many-to-many relation persist    forum.hibernate.org

It seems to me that you're trying to model a many-to-many association between two tables. One table is reflected in the Object Model by the class DocumenteGenerice and the other by the class Miscari. If this is the case you should have this: DocumenteGenerice Miscari

100. need extrafields from many-to-many relation    forum.hibernate.org

Hi all! I am a new hibernate user, and i am trying to get inside of the hibernate complex world. Currently i need to do the following. I have 3 tables defined: player, team and player_team_assoc. The third table (player_team_assoc) was defined to satisfy the needing of have a many-to-many relationship between team and player tables. Basically the tables structure is ...