1. Hibernate criteria: Joining table without a mapped association stackoverflow.comI'd like to use Hibernate's criteria api to formulate a particular query that joins two entities. Let's say I have two entities, Pet and Owner with a owner having many pets, ... |
2. How to map many-to-many association to a class mapped to two different tables? stackoverflow.comI have a Voucher - POJO mapped to two tables. The first mapping assigns an entity name "voucherA" and maps the POJO to TableA. The second mapping uses "voucherB" as entity ... |
3. Splitting one DB association into several collections in Hibernate stackoverflow.comI am trying to model such situation - there is a cash transfer (I mean a car that carries money), that has required amounts of each currency, and also an actual ... |
4. Only one of "create" or "delete", in parent child association, works at a time stackoverflow.comI am trying to implement parent child relation on traditional Order and Items tables. For this I am using uni-directional one-to-many association but I can make either "save" operation work or ... |
5. Is it considered a best practice to synchronize redundant column properties with associations in JPA 1.0 @IdClass implementations? stackoverflow.comConsider the following table:
|
6. hibernate: ternary association mapping stackoverflow.comTechnology Description: Hibernate annotation- 3.4.0.GA java 1.5 table : users_roles_branches columns : user_id, role_id, branch_id A user is assigned different roles for different branches of a company. Now i have one java pojo class
|
7. How to cleanly map 2 one-to-one associations in Hibernate stackoverflow.comI am currently trying to create two simple one-to-one mappings using Hibernate but somehow it doesn't work as I want it to. My primary class is called MailAccount and its mapping looks ... |
8. Hibernate: mapping many-to-one association to different parent table depending on type? stackoverflow.comI have tables which look like this: Item table:
Person table:
Company table:
|
9. Hibernate : set the value in an association table stackoverflow.comI have a classic n-to-n association between the tables
so I mapped it like that:
|
10. Mapping a qualified association with Hibernate coderanch.comIn my opinion, So orderID determines the relation between the two tables. This is the table structure should be follow as: Order (orderID, orderdate); OrderLine (orderID, lineNumber, description); On each order can be many order lines. Each order line belongs to precisely 1 order. So there is a one to many (?1 to n? or ?1:n?) relationship between Order and OrderLine. ... |
11. Special Association Mapping in Hibernate coderanch.comHello everyone. I have a special problem to solve. I have a relationship like this in my database: ____________________ _______________ | table one | | table two | |--------------------| |---------------| |*id | |*id_version | |foreign key |1-------------*|id | |____________________| |_______________| (* means Primary Key) I should have a set of table two-datas with the id specified in the field foreign key ... |
12. Hibernate Mapping (Many-To-One Association). Problem. This forum is my last hope. coderanch.comHi All I am new to hibernate. I am trying to do many-to-one mapping in hibernate. I am using 2 tables : 1) UserTypes(usertypesid is primary key) 2) Users (userid is primary key and usertypesid is foreign key from usertypes table.) The XML file for UserTypes table is as follows: |
13. Inheritance / Association in Hibernate coderanch.comHi, I am trying to use inheritance/association in hibernate. This is my scenario : 1) Author class that has a set of objects of type Book(abstract class) 2) FictionBook and RomanceBook extend Book and I am using table/concrete class strategy These are my mapping files : Author.hbm.xml : |
14. hibernate : ternary association mapped by a map (like book page 347) coderanch.com |
15. association mappings in hibernate coderanch.com |
16. Hibernate association mapping coderanch.comHi All, I have 2 tables : Employee and EmployeeRole. Both tables have their own Primary Keys. Employee has EmpId and EmployeeRole has EmpRoleId. How can i make one to one mapping between these 2 tables in Hibernate. Please guide me with both the hbm files. Thanks in advance. [ Edited to have a more meaningful subject line - Paul Sturrock ... |
17. Implementation of association classes and mapping in hibernate coderanch.comHi, I'm a total beginner at hibernate and I'm trying to learn how to use it together with the spring framework. I'm having trouble understanding what to do with association classes. First of all (and this is probably a more general question that has nothing to do with hibernate) how do you implement association classes as pojos/beans in java? What if ... |
18. Do you bother to map every association? forum.hibernate.orgHi Everyone, Please consider the following. You have a Person and they have a Company attribute which could be mapped as a many-to-one association. That is in the Person table there is a field CompanyId and is the foreign key of CompanyId in the Company table. Do you bother to map all associations like this bearing in mind you will not ... |
19. Mapping associations on alternate keys - property-ref forum.hibernate.orgHello, I would like to use HQL to query and join two tables that don't have a 'proper' foreign key association. Is this possible? So we basically have these 3 tables (distilled down to their essence). The Debtor and Item rows will be persisted separately and we purposely don't want a debtorId (way data is loaded we can't make the association ... |
20. Association mapping, column naming and deserialization forum.hibernate.orgHi all ! I come to you with a quite annoying problem. Ok so let's set up the background. I'm trying to map an association between two objects : a Vehicle an a Component, a vehicle having possibly several components of different types (i show only two in the sample code below). My Vehicle class is like that : Code: @Entity ... |
21. one-to-one association mapping forum.hibernate.org |
22. Inheritance on Associations forum.hibernate.org@Entity class Set implements Serializable { @OneToMany(mappedBy="set") @MapKey Map |
23. doubt in one-to-one association mapping forum.hibernate.org |
24. programmatically add association to mapping forum.hibernate.orgWe want to split our product into several components that the client can buy independently of each other. Nevertheless associations between the involved entities should be bidirectional. Let's say we have a Client Entity in our base component. We want to have bidirectional associations to this Entity from independent entities, like: CarShop.getClient(), Museum.getClient(), where CarShop and Museum don't know of each ... |
25. Which association mapping to use in this case forum.hibernate.orgI have following tables-columns Table 1 - User Columns -----UserId (Primary Key) -----BillingAddressId (Foreign Key references Address) -----ShippingAddressId (Foreign Key references Address) Table 2 - Address Columns -----AddressId (Primary Key) -----AddressInfo (like street,city,...) I am not sure which association mapping should be used for in this case, assuming bidirectional references. regards, Nirvan |
26. Child-parent association forum.hibernate.orgGood day! I have quite primitive problem. There are two tables: Code: CREATE TABLE VSTATUSDATE ( ID BIGINT NOT NULL, TKP BIGINT NOT NULL, ... ); and CREATE TABLE VTKP ( ID ... |
27. mapping association tables with annotations forum.hibernate.orgGreetings All, I've created a Eclipse/Java/Hibernate/MySQL/annotations/DAOs/HibernateUtil application roughly patterend after the canonical CaveatEmptor app. Up till now I've done 1:1 table:class mappings where each class:table has one pk of type Long, which works with the default DAO/DAOHibernate model. So far so good. Now I need to weave an ManyToMany association table into this fabric. This table consists of two columns, each ... |
28. Mapping many-to-many associations with a map forum.hibernate.orgHi, I have a many-to-many association which I'd like to map using a Map. To follow the example in the JPwH book, assume I have Category, Item, and CategorizedItem tables and entities. The category_item table is a join table with a PFK to category_id and item_id, and has additional columns. CategorizedItem can be a value type component in my case. Is ... |
29. Mapping a map for many-to-many association forum.hibernate.orgHi again, Regarding the same problem, I was thinking what else could be done if Hibernate prevents me to do this kind of mapping. I came up with this solutions: 1) Creating my own SizeNamePropertyMap that extends HashMap, and override the put(key, value) method so when Hibernate inputs the Size as a value, I get the name property of the Size ... |
30. Inherited Association Problems forum.hibernate.orgHello, all! I'm using Glassfish 3.0.1 and Hibernate 3.5.0-0.3 (installed via glassfish module installer) with Sun JVM 1.6.0-22. I have the following class layout on JPA, all using annotations, and using field-based access on JPA. @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name = "...") public abstract class Parent { @ManyToOne @JoinColumns(.....) private OtherClass other; ... } @Entity @DiscriminatorValue(...) public class BigChild extends Parent ... |
31. Inheritance is ignored in case of associations forum.hibernate.org// Code to start the session is omitted EntityB entityB=new EntityB(); entityB.setSomeValue("test"); EntityC entityC=new EntityC(); entityC.setEntity(entityB); session.save(entityC); ... |
32. About inheritance mapping and association query using JPA forum.hibernate.orgi try to get the object of User. and then the brands and merchants will not be separate with filed 'type'. the error like this: org.hibernate.WrongClassException: Object with id: 1 was not of the specified subclass: com.mofalife.hibernate.entity.Merchant (loaded object was of wrong class class com.mofalife.hibernate.entity.Brand) table of 'base' Code: type id name ... |
33. Mapping many-to-many association table with extra column(s) forum.hibernate.orgNewbie Joined: Fri Jul 11, 2008 5:35 am Posts: 4 Hello I'm rather new to hibernate I've encountered the following problem DB contains 3 tables: User and Service entities have many-to-many relationship and are joined with the SERVICE_USER table as follows: USERS - SERVICE_USER - SERVICES SERVICE_USER table contains additional BLOCKED column. What is the best way to perform such a ... |
34. How to get a many-to-many association as a map? forum.hibernate.org |
35. Inheritance mapping - a problem with many-to-one association forum.hibernate.org |
36. How to map this association forum.hibernate.orgHello, Can someone help me how to map the relationship between these two tables.. APPUSER (ID, USERID, USERNAME, ROLE, ISACTIVE) --- here only Id is unique, there will be only one active record for a username but many non-active records LOGINAUDIT(ID, USERNAME, LOGINTIME) So the association is based on username which is not a unique and/or primary key - and this ... |
37. Problem mapping m-n association object as table forum.hibernate.orgHi, I'm trying to, for various reasons, map an association object as a table. The table and object graph looks like this: Code: A -- * B ---* C | * BtoD * -- D Here's the mapping on the relationship ... |
38. Association class mapping sample forum.hibernate.org |
39. Ternary association: Why not collection in the map values ? forum.hibernate.org |
40. Parent-Child Association forum.hibernate.orgParent p = (Parent) s.load(Parent.class,pid); Child c = new Child(); p.addChild(c); s.save(c); s.flush(); |
41. How to set the association column in one-to-one mapping? forum.hibernate.orghello everyone, I need advices about the imaginary scenario below; Table Person : PID, HotelID Table Hotel: HID, Name, Location Class Person : Long PID, Hotel hotel Class Hotel : Long HID, String name.... HotelID is the foreign key references Hotel ID in Person The relation is : each person stays in one hotel. (one-to-one) hotel can have many person or ... |
42. one-many mapping - Association references unmapped class forum.hibernate.orgHello all, I am trying to do a one to many mapping between com.aol.ic.art.data.domain.Request class and com.aol.ic.art.data.domain.RequestStatus class and following are my mapping documents. I am receiving a complaint that net.sf.hibernate.MappingException: Association references unmapped class: com.aol.ic.art.data.domain.RequestStatus Following are the details and mapping documents. Please reply ASAP. Hibernate version: hibernate2.jar Mapping documents: REQUEST ... |
43. Mapping a "multivalued" ternary association forum.hibernate.orgI can tell you a way to map it if you like, bit it's probably not what you're thinking about. If I were mapping this, unless there were some other reason I couldn't (that you haven't mentioned), I'd model the relationship class explicitly. That is, I'd have a class named something like ChatUserRoleRelationship. It's look something like Code: class ChatUserRolRelationship { ... |
44. Mapping Association : 1..1 <--> 0..1 forum.hibernate.orgI have a parent child relationship A (1..1) --> (0..1)B Class A { private B b; } I dont want a B_ID reference in the 'A' DB table. just the A_ID FK in the 'B' table. In the mapping of B, I have: |
45. Inheritance mapping works with HQL but not with association forum.hibernate.orgHave a question regarding results I'm observing for an inheritance mapping (using the hierarchy in a single table approach, Hibernate version 2.1.6). With the mapping below for a Closeout, I am able to successfully retrieve subclass instances via HQL. However, when I try to load them via one-to-many assocation from another object, the discriminator value for the subclass seems to be ... |
46. Column mapped as an association and as a property forum.hibernate.orgUsing Hibernate 2.1.7... I'm porting a legacy persistence framework to hibernate. We have a lot entities with natural keys and to-one relationships to these tables from other entities. If I want to create an many-to-one association to this table and also be able to access the foreign key value without fetching the related entity, the only resolution I can find is ... |
47. Ternary association with Map and JSTL forum.hibernate.org |
48. One-To-One mapping with an association table forum.hibernate.orgHibernate version: 3.0 beta 2 I was wondering how to map one-to-one relations with an association table. I have two completely different types of users. I have only one login table. The login table is associated to these two types of user-tables with two association tables. Example: Code: -- Usertype A CREATE TABLE user_a ( id int4 ... |
49. Parent - children association forum.hibernate.orgNewbie Joined: Tue Feb 22, 2005 1:18 pm Posts: 3 Hi Well, Ive problem with simple parent-children association (Hibernate 2.1.8). Ive read manual and I really dont see where could be an error. begin trans parent = hs.load(some.namespace.Parent, id); parent.addChild(child); end trans and session close This causes net.sf.hibernate.HibernateException: Batch update row count wrong: 0 And this works: begin trans parent = ... |
50. How to map ternary association's entity in Map based col'ns? forum.hibernate.orgHibernate version: 3.0rc1 Is it possible to create a ternary association entity and have it mapped on one side of the association (the collection side) as a map element keyed on the element on the other side of the association? The model of what I'm trying to map is: Code: class A { Map collection; } class B ... |
51. Problem when mapping an association with class inheritance forum.hibernate.org |
52. Mapping association issue - forum.hibernate.org |
53. Problem with mapping association forum.hibernate.orgHi Guys, I have the following problem. I have a class A which has two associations one to many associations with classes B and C. I use a List object to handle these associations. The classes B ans C are mapped to the same table. They both extend class D. In the mapping xml file of class A I have the ... |
54. Mapping for an association entity forum.hibernate.orgpublic class Table extends AbstractModelObject { protected Integer id; protected String name; protected String schema; protected List columns = new ArrayList(); protected List primaryKeyColumns = new ArrayList(); protected Boolean ... |
55. How do you use more than 1 child association with Example? forum.hibernate.orgList results = session.createCriteria(Parent.class) .add( Example.create(parent).ignoreCase() ) .createCriteria("child1") .add( Example.create( parent.getChild1() ) ) .createCriteria("child2") ... |
56. Mapping one-to-one association across three tables forum.hibernate.orgI have three tables with the following struture: client [ client_id, ...] licence [licence_id, client_id, ...] photo [ photo_id, client_id, ...] I want to have an association where the Client object contains the Photo object. it is a one-to-one association - though not enforced by the schema. This scema has been implemented very akwardly - and (of course) cant be changed.. ... |
57. many-to-any association inside a Map forum.hibernate.orgAfter struggling for a long time trying to get a many-to-any mapping working inside a Map with implicit polymorphism (table-per-concrete-class) I've finally figured it out. I've seen a couple posts asking for an example of a working many-to-any association, since seeing an example could've saved me a lot of time I'm going to post mine here. Code: |
58. Mapping Ternary Association in Hibernate forum.hibernate.orgAssuming I have the following: A* <-----> *B and C has also has a many-to-many relationship to the association of A and B. In my situation, C is dependent on A and B. From a relational perspective, I have the following two associative tables: Table AB with a_id, b_id and table ABC with a_id, b_id and c_id. In table ABC, a_id ... |
59. Beginner mapping question (associations) forum.hibernate.orgFirst off, please don't flame me becasue I'm sure this question has been asked before. I have searched the forum as best I can but i'm not sure what to search for exacty. I have the book 'Hibernate in Action', I've read the FAQ, I've looked at teh documentation and I've about given up thinking that I just don't have the ... |
60. Criteria for a One-to-Many association through a Map forum.hibernate.orgNewbie Joined: Wed Aug 31, 2005 11:20 am Posts: 13 Hi there. I have 2 class : Priority PriorityDescription There is a relation One-To-Many between Priority (One) and PriorityDescription (Many). Here is what Priority contains : Long id Short level String code Map |
61. Map association key in map value (map-key-many-to-many) forum.hibernate.orgMy Subject class has a map collection of forms, where the key to each form is a Study object. Unfortunately, I haven't found a way to use the Map mapping for this association since the study_id key is in the form's table. The schema looks like: Code: create table SUBJECT_FORM ( SUBJECT_ID INT8 not null, ... |
62. Association map with object as a key cease to work in rc2 forum.hibernate.orgAuthor Message Bazi Post subject: Association map with object as a key cease to work in rc2 Posted: Mon Nov 07, 2005 1:06 pm Newbie Joined: Thu Aug 25, 2005 3:59 am Posts: 7 Location: Czech Republic, Prague Greetings, I have problem with association map using object as a map key. Everything worked fine in Hibernate 3.1 beta 3. ... |
63. Association mappings forum.hibernate.orgI am trying out the association described in 8.2.1 of the Hibernate 3 manual. I have slightly modified the mapping (see reason below). |
64. Problems with Mapping Associations forum.hibernate.orgI have a problem making a mapping association between two classes, in hibernate 3.0 The fisrt one is like public class ClassA implements Serializable { private long id; private String name; public ClassA() {} public long getId() { return id; } public void setId(long id) { this.id = id; } public String getName() { return name; } public void setName(String name) ... |
65. Hibernate Association Mapping forum.hibernate.org |
66. Mapping association problem. forum.hibernate.orgNewbie Joined: Mon Nov 28, 2005 4:56 am Posts: 4 Hi, As i am trying to execute event-person example of hibernate i am able to work on individual but when i start working with mapping associations i am geting some error as shown below. ############################################################################################# D:\hibernateexample>ant run -Daction=store Buildfile: build.xml clean: [delete] Deleting directory D:\hibernateexample\bin [mkdir] Created dir: D:\hibernateexample\bin copy-resources: [copy] ... |
67. Having trouble mapping an association forum.hibernate.orgSay you have objects A, B, C. Database table tbA has no reference to tbC. Instead tbB acts as a linking table between the two. Every A has exactly one B. Each B may have a C ( or none ) More than one B can share a C. tbB is as follows: tbB( A_ID INT, B_ID INT ) To give ... |
68. Unable to map an one-to-many association to an ideal-databa forum.hibernate.orgHibernate version: Hibernate 3.0.5 Consider a scenario as shown in Fig. 1. Here the hierarchy of P is mapped using Table-Per-ClassHierarchy and that of X is mapped using Table-Per-ConcreteClass. The cardinality of association is one-to-many (from P to X) and the association is bidirectional. < |
69. Problem with map association forum.hibernate.org |
70. Entity associations using forum.hibernate.org... |
71. using a map to represent ternary associations forum.hibernate.orgI have four tables: Roles the roles in the system ACCESS_TYPE: read, write, etc Property: resources in the system I have a ternary associations represented by a fourth table:ROLE_MAPPING I created three entities to represent the roel, property and access type. I wanted to represent the ternary relation by using a map inside the entity Role. I am struggling with that. ... |
72. EntityMode.Map Bi-Directional associations, stackoverflow forum.hibernate.org |
73. Discussion about association mappings forum.hibernate.orgI have dipped my toe into Hibernate a couple of times and though I have the basics running and have found it very impressive, I find a lot of the details regarding the intracies of mappings hard to follow (particularly ones between entities and values). is there anyone in the UK who would be interested in talking through issues on the ... |
74. HQL Syntax for association Map forum.hibernate.orgHi, I have a POJO Object like below Class User { String firstName; String LastName; Map properties; } The properties attributes is associated in hibernate mapping as below User_properties table has 3 columns parent_fk foreign ... |
75. map one-to-one association to same class forum.hibernate.orgHi Guys, This seems like it should be simple to do, yet I'm struggling. I have a class called Accessory that I would like to carry a string property of accessoryname. The issue is the table is separated such that there's an accessory table that describes its id, and then a separate accessoryDetail table to identify its name and other details, ... |
76. how to map a set of one-to-one associations forum.hibernate.orgI have the following Domain objects: -Person -Address - Mailing Address - Home Address Mailing address and Home address inherit from Address. A Person can only have one Mailing Address and only one Home Address. Hence, it makes sense for there to be a mapping that retrieves a Set of addresses. It also makes sense for there to be a mapping ... |
77. Mix inheritance and association mapping forum.hibernate.orgHi, Hibernate version: 3.1.3 I have the following database model : Code: create table ingredients ( id integer not null, name VARCHAR(255), primary key (id) ) create table recipes ( id integer not null, name VARCHAR(255), primary ... |
78. parent/child association with property-ref and where clause forum.hibernate.orgHi, I'm working with a content management system that is limited in the sense that it does not create proper relationships between tables, i.e. foreign key constraints to primary/unique keys. Each table has a database id, a content id and a status field which describes if a particular row (i.e. the content) has been deleted. Relationships between tables can be built ... |
79. How do I mapping optional association collections parent and forum.hibernate.orgFirst, I'm not good at English so I hope you understood my mistake. I have two tables and associate bi-direct between GroupSalesGoal(Parent) and SalesGoal(Child) I want access some child of whole collections from parent by set collection for example parent get collection of child goal_month is '200610' in group_id='0103' and goal_item={'sales', 'adv', 'tax'} so, how do I mapped ? Hibernate version:3.0 ... |
80. Many-to-Many association mapping fails forum.hibernate.org |
81. explicit association table repres. vs. common m2m mapping forum.hibernate.orgI have a simple User/Group relationship. Tables [user] u_id int name varchar(200) [group] g_id int name varchar(200) [usr2grp] u_id int // foreign keys g_id int // foreign keys status int2 as u can see the relationtable has some extra column to hold a status value (BLOCKED, NOT_BLOCKED). I mapped these tables to the following classes/methods. class User -> table user class ... |
82. One-to-many association mapping issue(suggestion) forum.hibernate.orgI am using hibernate 3.2.1, java 6 What would be the correct way of mapping the following scenario in hibernate? I want to acheive the following: User table ------------ A B C Products table ---------------- P1 P2 P3 Products Rating table -------------------------- R1 P1 A R2 P1 A R3 P1 A R4 P3 A R5 P1 C R6 P1 C R7 ... |
83. association mapping question forum.hibernate.orgHi, I'm using hibernate 3.2 with mysql 5. I have a question concerning a mapping strategy for Associations. Say I have class A, B and C. A and B each have an unidirectional association to class C. Each A and B is associated only with one Object of type C, but each C Object can be associated by any number of ... |
84. Mapping associations, filtered by join? forum.hibernate.orgI'm using Hibernate with a legacy database that has an association table between two other tables. Unfortunately, sometimes either of the things being associated can go into an inactive state without the related association being removed, and there is no state field on the association table itself. When I deal with this table, I do not want to get back rows ... |
85. Mapping associations forum.hibernate.orgHello. I'm newbie with hibernate. I'm trying to map an association but I'm not sure how to do. I have 3 tables: USERS( id_usr, name, email....): P.K.: id_usr USERS_ITEMS( id_usr, id_item, amount): P.K.: (id_usr, id_item) ITEMS( id_item, name ): P.K.: id_item As you can see an user can be related with many ITEMS (relation USERS_ITEMS) and an item can be related ... |
86. Joins without mapped associations forum.hibernate.orgI am trying to create either Criteria or HQL where I skip an association but having problems find out if it is possible. Say I have table A which has a one to many with B. B contains a foreign key that is also in C. But no mapping is defined between B and C. It is not mapped as I ... |
87. Newabie: Problems with Mapping a one-to-many association forum.hibernate.orgHi Everybody! I am a newabie to Hibernate and have my first greater problem with a many-to-one association on the same object : Following Situation: I have a abstract superclass "Status", and two subclasses "CustomerStatus" and "ReservationStatus".The abstract superclass inherits a list "SuccStatus" in which status objects are being held, which are the successor stati. That means that one status object ... |
88. Problem with the mapping of an association class forum.hibernate.orgHello, it's this relation i want to map : My mapping (just the association class) Code: |
89. Mapping Two One-To-One associations with the same type forum.hibernate.orgpublic class Folder { @OneToOne(cascade = CascadeType.MERGE) private User user; } public class User { @OneToOne(mappedBy = "user") protected Folder sentFolder; @OneToOne(mappedBy = "user") protected Folder savedFolder; } |
90. Association mapping on the same table forum.hibernate.org |
91. Association class mapping forum.hibernate.org |
92. Hibernate mapping "where" clause for associations forum.hibernate.orgI am curious about the arbitrary "where" clause in a Hibernate mapping file. The only information I have found on it is the following (from the Reference Guide): "specify an arbitrary SQL WHERE condition to be used when retrieving objects of this class" My question is: if I add a where clause to a Hibernate mapping file for class A, does ... |
93. ternary association mapped by a map (like book page 347) forum.hibernate.orgPaskos, I remember having the same issue some time ago in my project. I had a ternary association that had one entity of the association nullable. The mapping was looking like: I could not save the record when the nickname ... |
94. Deleting Child records in One to Many Association forum.hibernate.orgParent parent = (Parent)session.load(Parent.class, new Long(id)); Iterator iterator = (Iterator) parent.getChilds().iterator(); while(iterator.hasNext()) { Child c = (Child) parent.getChilds().iterator().next(); parent.getChilds().remove(c); session.delete(c); session.flush(); } for (int i = 0; i < newChildsList.size(); i++) { Child c = (Child) newChildsList.get(i); c.setParent(parent); set.add(c); } parent.setChilds(set); session.saveOrUpdate(parent); transactio.commit |
95. mapping multiple associations with the same class forum.hibernate.orgHi laxu, the problem is: how should Hibernate decide which of your PayrollSection objects is going into the "shiftSections" list, which into the "paymentSections" list and so on. After all, in the database table for your Payrolls there are only foreign keys to the owner object "Payroll". So, you must have some information on the role each PayrollSection object has. I ... |
96. Association & Collection Mapping forum.hibernate.org |
97. Association & Collection Mapping forum.hibernate.org |
98. Mapping messy associations forum.hibernate.orgHi, I'm mapping my old (and poorly structured) database in hibernate. I have one table called Account, another called Fund, and a third called Balance. Balance says how much money an account has in a given fund. So Account has a one-to-many relationship to Balance. Fund also has a one-to-many relationship to Balance. So here's where it gets messy. Balance doesn't ... |
99. Mapping problens: associations with interfaces forum.hibernate.orgI think that the issue you're running into here is that Hibernate can't infer an inheritance strategy (and thus cannot create the appropriate relationships in the database) from your mapped superclass. Essentially, the Order table will need to have a foreign key to the destination table to satisfy the @ManyToOne relationship - but since there's no common base class, Hibernate can't ... |
100. association mapping problem forum.hibernate.orgI have problem with assiciations for the following relations: a person can purchase many items. so records in purchase table can be like following: person1, item1, qty,amt, time person1,item2,qty,amt,time ..... CREATE TABLE person ( person_id bigint(10) NOT NULL, person_name varchar(50) default NULL PRIMARY KEY (person_id) ) CREATE TABLE item ( item_id bigint(10) default NULL, item_name varchar(100) default NULL, item_price double(10,2) default ... |