relation 3 « Map « JPA Q&A





1. orphanRemoval on OneToOne relation with Hibernate 3.5.4    forum.hibernate.org

Hi, did someone try to map a OneToOne relation with Hibernate 3.5(.4) and "orphanRemoval=true" ? I have an class A with a oneToRelation with a classe B : @Entity public class A{ @OneToOne(cascade = {CascadeType.ALL}, orphanRemoval=true) B b; ... } If i do this : A a = new A(); B b1 = new B(); a.setB(b1); em.persist(a); B b2 = new ...

2. cascading insert for one-to-many relation parent/child table    forum.hibernate.org

I have two tables with parent/child relation. Child table have two columns, both columns make a primary key. Parent's key is one of the primary keys in child table but parent/child has one-to-many relationship so "generated key" in child table is not unique. Uniqueness is defined by combination of columns in child table. I have cascade="all" between parent/child tables. If cascading ...

3. optional OneToOne relation no longer works    forum.hibernate.org

I have a entity with an optional unidirectional one-to-one relationship. @Entity @IdClass( value = MbiMsgpa.PK.class ) @Table( name = "mbi_msgpa" ) public class MbiMsgpa implements Serializable, Comparable ... /** Relation with MbiMsgpt. */ @OneToOne( cascade = { CascadeType.PERSIST, CascadeType.REMOVE }, fetch = FetchType.LAZY ) @Cascade( value = org.hibernate.annotations.CascadeType.DELETE_ORPHAN ) @NotFound( action = NotFoundAction.IGNORE ) @PrimaryKeyJoinColumns( { @PrimaryKeyJoinColumn( name = "msghd_serial", referencedColumnName ...

4. Problem with one-to-many relation    forum.hibernate.org

Hi, I implemented hibernate one-to-many relation in my application with by-directional relation. I am using hibernate annotation to map the table with classes. My class structure's are like : Parent class Code: @Entity @Table(name = "country") public class Country implements Serializable { ------------- private java.util.Collection state = new java.util.ArrayList(); ...

5. one-to-one relation    forum.hibernate.org

I'm having problems with an one-to-one relation. The error is: Code: ERROR - (BasicPropertyAccessor.java:118) - IllegalArgumentException in class: data.Employee, setter method of property: storeOwner ERROR - (BasicPropertyAccessor.java:122) - expected type: data.StoreOwner, actual value: java.lang.Boolean ERROR - (CustomersPanel.java:586) - IllegalArgumentException occurred while calling setter of data.Employee.storeOwner This doesn't says the problem is the one-to-one relation, but I started getting this error when ...

6. Setting lazy For One-to-One relation suing Configuration Obj    forum.hibernate.org

I can set one to one relation from hbm file using constrained="true" lazy="proxy" but the same thing i am trying to do from configuration Object using : Code: Configuration cfg = new Configuration().configure(); Iterator it = cfg.getClassMappings(); while (it.hasNext()) { ...

7. ConstraintViolationException with a many-to-many relation    forum.hibernate.org

public void removePerson(int personId){ Person p = findPersonById(personId); SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); Session sess = sessionFactory.getCurrentSession(); Transaction tx = sess.beginTransaction(); ...

8. problem saving a record with many to many relation mapping    forum.hibernate.org

Newbie Joined: Fri Nov 19, 2010 11:40 am Posts: 1 Hello I'm working on a kind of big project integrating osgi, spring, hibernate and jsf. On that project I have a many to many relation between 2 entities. All works well for the mapping to the database, but when it comes to inserting the record on the table concerned by joining ...

9. What to do if there is many to many relation in the database    forum.hibernate.org

I am new to the Hibernate framework. I have many to many relation in the database. I understand that an associatiion table will be created to store foreign keys. But, I think something has to be done if I use the Hibernate framework. My question is what has to be done? Thank you.





11. LazyInitializationException ManyToMany Relation CRUD    forum.hibernate.org

Hi, in our application we are using 2 entities AppUser and AppGroup wich are related in a ManyToMany Relation. We integrated different views for the CRUD functionality for each entity. First, the List where all entities of one type are depicted. After selection of one entity each attribute is shown in a second view, and by using the "edit" button the ...

12. fetching data using hibernate in caseof one to many relation    forum.hibernate.org

hii..... i have two tables having one to many relationship that is bidirectional. 1. Event 2. Ticket An event contains a list of tickets whereas an instance of ticket contains reference of that event. I am at Dao persistence level for event and want to fetch data from event on basis of maximum price of ticket. I have written sql query ...

13. Question about table relations    forum.hibernate.org

...

14. OneToOne relation: Who gets the FK column?    forum.hibernate.org

Assume I have two tables AAA and BBB which are associated in an 1:1 relationsship. So one of the two tables must hold the Foreign Key (column) of the other. How can I tell (with Annotations) that table BBB should hold the foreign key of table AAA and NOT vice versa? Peter

15. Using Identifiers in many-to-one relations    forum.hibernate.org

Hi, I am using Hibernate as a persistence provider in a web application. I have a Customer and CustomerType POJO with surrogate keys (systemId of type java.lang.Long). Customer contains an instance of CustomerType, and the user can select the customer type using a drop-down list from a JSF page. The systemId of the customer type is placed in the systemId of ...

16. Why is this unidirectional relation unusual ?    forum.hibernate.org

For me One-to-Many unidirectional relation as explained in 8.2.3 is unusual and not recommended because it doesn't fit any UML-specification and because it isn't a true unidirectional relation. Unidirectional implies that the right side of the relation shouldn't know anything about the left side, so from this point of view it makes absolutely no sense to restrict the left side cardinality ...





17. [Hibernate Annotation] How to ignore a child/relation update    forum.hibernate.org

@Service("aService") public class A_ServiceImpl implements A_Service { @Autowired private A_DAO aDao; @Transactional(propagation= Propagation.REQUIRED, readOnly=false) public void updateA(A a) { aDao.update(a); } } ...

18. self relation    forum.hibernate.org

@OneToMany(fetch=FetchType.EAGER, targetEntity=Wforgunit.class) @NotFound(action = NotFoundAction.IGNORE) @JoinColumns({ @JoinColumn(table="wforgunit", name = "codit", referencedColumnName = "codit", updatable = false, insertable = false), @JoinColumn(table="wforgunit", name = "idorg", referencedColumnName = "idorg", updatable = false, insertable = false), ...

19. Hibernate with multi foreign keys in a relation table.    forum.hibernate.org

Hi, I just started work on hibernate with struts 2 using weblogic & Oracle. I have following requirements 6 tables - Product(id, name) , Report(id, name) , Package(id, name) , Class(id, name) , Methods(id, name), data(id, error) 1 relation table - Product_Reference ( product_id, report_id, pkg_id, class_id, mtd_id, data_id) All mapping define in product_reference tables. Also, they tree data structure - ...

20. Howto update a child in a Parent/Child one-to-many relation?    forum.hibernate.org

Hi all, I feel the documentation is not very clear on one point, and cannot find anything on internet : i have a parent/child relation between to types of objects with a cascade="all-delete-orphan" (both parent and children are already correctly inserted in database) and i just want to update one child of a parent. Here is my code: Code: ...

21. Hibernate mapping relations with Annocations    forum.hibernate.org

Author Message Zagros Post subject: Hibernate mapping relations with Annocations Posted: Fri May 06, 2011 10:52 am Newbie Joined: Fri May 06, 2011 10:42 am Posts: 1 I'm just stumped on using annotation style hibernate mapping of two objects below. I have a User object, and a Province Table. The primary key of both of these tables are GUID. ...

22. [3.6.4] Fetching 1:n relations using just one query    forum.hibernate.org

Hi, since the version 3.6.4 a bug in hibernate was fixed (which is a good thing) but the fix now breaks my application (which is bad) and i have no clue how i am supposed to do what i would like to do :( The fix which breaks my application is: http://opensource.atlassian.com/project ... e/HHH-2049 My situation: I have a 1:n relation... ...

23. Mapping one-to-one relation as primitive type    forum.hibernate.org

Hi, the company I work for has a Hibernate mappings for entities model - this was created from scratch, well designed and has all correct, working mappings - it works with Derby database. Now we want to use the created entities and create just mapping files to be able to read legacy data from another database, which has slightly different schema, ...

24. Create object in relation through factory    forum.hibernate.org

25. Updating join table in many-to-many relation    forum.hibernate.org

I got three tables; User, UserRole and UserRoleRelationships (join table). Both insert and delete for user with roles works great, but when I'm trying to update a user without inserting roles, hibernate delete all records for the corresponding user in the join table. I have also tried to select all user roles and the insert them into the new user. This ...

26. one-to-many relation-constrait violated-parent key not found    forum.hibernate.org

Hi, I am facing problem when creating one-to-many relationship. I am getting Caused by: java.sql.SQLException: ORA-02291: integrity constraint (C900_CO_LOCAL.FK_STOCK_DAILY_RECORD) violated - parent key not found The issue i am getting when i add the foreign key constraint in child table Please find the code below. CREATE TABLE STOCK ( STOCK_ID NUMBER NOT NULL, STOCK_CODE VARCHAR2(10) NOT NULL, STOCK_NAME VARCHAR2(20) NOT NULL, ...

27. Relation with more than 2 columns    forum.hibernate.org

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

29. Left join Without relation    forum.hibernate.org

You can't join in HQL without mapping. The keyword "on" is native query and not recognized by HQL. The example seems like you can just do a simple selection (select item.id from Item item or select stock.itemId from Stock stock). If you just simplified the example and you need all of the items even if there is no associated Stock I ...

30. SQL Error: 0, SQLState: 42P01 with Map relation    forum.hibernate.org

Newbie Joined: Fri Oct 07, 2011 5:13 pm Posts: 2 I have an exception when loading an object with @OneToMany map relation, which seems like a bug. Here is the object class: Code: @Entity @Table(name = "customer") public class Customer implements java.io.Serializable { private Integer custId; private String firstName; ...

31. updating 1-1 relation a new record is added on child item    forum.hibernate.org

Dear all, I've a great issue with hibernate, with annotated classes. I've a 1 - relationship (i've this issue also with 1-n relationship) between user and role, that is a user must have one and one only role. In my User class I've Code: @OneToOne(cascade = CascadeType.ALL) @JoinColumn(name="ID_ROLE) private Role ...

33. Criteria with @ManyToMany relations    forum.hibernate.org

Newbie Joined: Fri Nov 11, 2011 4:44 am Posts: 4 Hi, I have a relation many to many between users and projects: @ManyToMany ( fetch = FetchType.EAGER )//Tipo de busqueda @JoinTable(name="USERPROJECTS" //Tabla de intercambio , joinColumns={@JoinColumn(name="IDUSER") //Llave fornea } , inverseJoinColumns={@JoinColumn(name="IDPROJECT") //Llave fornea }) @Where( clause = "DELETIONDATE is null" ) private List projects; and I need to create a criteria ...

34. Design question with many to many relations    forum.hibernate.org

Hi, I'm quite newbie on Hibernate and i would ask you about my db design and if it's make sense or not according to what i would like to get. Let's say i have two things to manage in my app: people and their relations. So i have p1 and p2, my two guys. Two people could share several relationships simultaneoulsy: ...

35. Hibernate ResultTransformer and hibernate relations    forum.hibernate.org

@ManyToOne(cascade = CascadeType.ALL) @JoinColumn(name = "fk_department_id") private Department department; @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "employee_role", joinColumns = { @JoinColumn(name = "employee_id") ...

36. Reverse One to One Relation with shared primary key issue    forum.hibernate.org

Hello, I'm using hibernate-3.2.4.sp1 with hibernate-annotations-3.2.1.ga and I keep running into the same problem. Here are my tables: WWS_Batch { - objectid (PK) ... } WWS_BatchStatus { - batchID (PK, FK(wws_batch.objectid)) ... } I define the classes as follows: Code: @Entity @Table(name="wws_batch") public class Batch implements Serializable{ @OneToOne(mappedBy="batch", cascade=CascadeType.ALL) ...

37. relation    forum.hibernate.org

Dear all I have problem when I want to store data in two tables which have Master-Detail relation (I mean 1 to many relation). I program in this way : IMasterDao masterDao = RemixDaoFactory.getMasterDao(); IDetailDao detailDao = RemixDaoFactory.getDetailDao(); Master master = masterDao.findMasterById("1"); Detail detail = new Detail(); detail.setDetailName("detail"); detail.setMaster(master); detailDao.createDetail(detail); As you see in the red line, I set the relation ...

38. unwanted many-to-one relation fetch    forum.hibernate.org

I have a model where AttributeValue is related to Attribute using many-to-one one-direction relation. When I load AttributeValue instance hibernate fetches also related Attribute entity (I see it from sql logging). How can I disable it? I load it by: session.load(AttributeValue.class, new Integer(1)); Here are my class mappings: ...

39. many-to-one failing if relation is broken (ObjectNotFoundEx)    forum.hibernate.org

I am accessing a couple legacy databases over which I have no control. There is some (actually, quite a bit) of "bad data", mostly broken relations. My mappings contain many-to-one directives to this data and things fail with ObjectNotFoundExceptions. Should this be happening or is there something I can do to prevent this from happening? Thanks!

40. one to many relation with no contraint    forum.hibernate.org

One of the Key benefits of Hibernate is that you don't need to define the joins as it uses the foreign keys to build it for you. You can use HQL (with the where join) to get the information but that would be the extent of it. Unless the data or application is totally broken I wonder why you cannot have ...

41. could no create child object alone in parent-child relation    forum.hibernate.org

Hi, I have a requirement in my application to use a Parent-Child relation as described below. Parent : Folder Child : subFolder or Document I need to do the following: 1. create the parent alone with out any children 2. create a child alone in an existing parent folder I used the following relationship mapping

42. deletes with relations    forum.hibernate.org

I have a relation A->B. one-to-one. I want to delete both the objects as part of a transaction. Do I need to worry about in what order I need to delete these objects. Can I delete B first , then A and then commit transaction or do I need to worry about constraint voilations when deleting ( eg. I would delete ...

43. Not fetching relations possible?    forum.hibernate.org

Hi all, I have a non-lazy graph of class A having collection of B and C. In one occation I wanted to force Hibernate to ONLY load A. I.e: s.find("from A as a where a.name = ?"....) But this, of course, fetches A and everything related. Any ideas how to fetch A only, using find?

44. New user -> problem with many-to-one relation ship    forum.hibernate.org

Newbie Joined: Wed Nov 26, 2003 1:27 pm Posts: 9 Location: Overland Park KS I'm a new user.. started using Hibernate last week. I've the following relationship. [b]Many-to-one relation between AnnualTract and Tract Objects.[/b] What i'm trying to accomplish is when I find AnnualTractPersistenceObject I need to have the associated TractPersistenceObject also populated. Here is the mapping i'm using followed with ...

45. Navigating many-to-many relations in HQL    forum.hibernate.org

I'm migrating from Castor to Hibernate and have a question about how to navigate many-to-many-to-many relations in HQL. The datastructure of my application is like this: Item -- Collection -- Acl -- Role -- User (all relations are many-to-many). Now, in Castor I could write something like: SELECT i FROM Item i WHERE i.id = $1 AND i.collection.acl.role.user.username = $2 in ...

46. many to many relation    forum.hibernate.org

Newbie Joined: Mon Dec 22, 2003 2:25 pm Posts: 2 Hi I am working on tomcat 4.1.28 struts 1.2B2 and Hibernate 1.2.5 and mySQL I have a many to many relationship betowin author and document and i use the table writes in database. author <------------- writes ----------------> book the BOs are: package gr.tera.alternative.bo; import java.io.Serializable; public class BaseBO implements Serializable{ protected ...

47. Mapping aggregates and handling non-existent relations...    forum.hibernate.org

Howdy, I just have two general questions, as I've been able to work through most of my issues by reading this fabulous resource. And actually, I have a plan to address my first question (mapping aggregates). Background: To get some experience with Hibernate, I'm attempting to map a bugzilla database I use at work. For the most part I've been able ...

48. Is it possible to have relations to itself?    forum.hibernate.org

49. ID of many-to-one relation    forum.hibernate.org

Senior Joined: Sun Jan 04, 2004 2:46 pm Posts: 147 Is there any way of retrieving a foreign key in a table without hitting the database for the table the foreign key relates to? ie Code:

50. Question about one-to-one relation    forum.hibernate.org

I have defined a one-to-one Relationship for model.CatPersistent to the model.PersonPersistent. and ...

51. Insert on Parent only on a one-to-many relation    forum.hibernate.org

Hi, Is there any way to insert a row in the parent table alone using hibernate. My case is like this A department table is related to an employee table in one-to many fashion. But while trying to insert a row in department, i am force to add a set of employees also.The ddl used to create the schema are as ...

52. How can I map a more to more relation, but with one atribute    forum.hibernate.org

I need to represent just that. My english is very bad, so I show you one E-R diagram: ---------- ----------- --------- | Name |------------->| Name | | | ---------- | Event |<--------|Event | | Posts | --------- | | ----------- One user could be register in one or more Event, and in one Event could be registered one or more users. ...

53. how can i define a 0-1 relation?    forum.hibernate.org

i want define a 0-1 relation between person and cat. cat has owner as property, and person knows nothing about cat. Below are the Person and Cat mappings respectively: ...

54. Many to 1 relation - TransientObjectException    forum.hibernate.org

Before putting out my problem these are the various imp things. Using: Hibernate 2.1 Database:DB2 Application - Web App -- Entities are loaded in 1 session and then saved in another session. Now the problem Description------ EntityA has a relationship with EntityB, EntityC where EntityA will always be a child of EntityB and can also be a child of EntityC based ...

55. Looking for a rich example of Hibernate XDoclet relations    forum.hibernate.org

I am looking for examples of how to express relations with Hibernate XDoclet tags. I don't care for the hbm files, I only want to use XDoclet tags. It would be good if a example would be existing with a rich Model which contains all kinds of relations. Can you tell me one? I looked at workshop_toolset_java.tar.gz, but it does not ...

56. ODBC-error with MS SQL Server and parent/child relation    forum.hibernate.org

Hi, I have a very bad problem when trying to load or query for persistent objects. I'm getting an ODBC-error S1002 - invalid descriptor index - but only under specific circumstances! My configuration is: - MS SQL Server 2000 (SP3) - SQL Server ODBC driver 2000.81.9042.00 - JDBC-ODBC-bridge sun.jdbc.odbc.JdbcOdbcDriver from JDK 1.4.2 - Hibernate 2.1.2 I have a very simple class ...

57. BatchUpdateException when storing a many2many relation    forum.hibernate.org

Newbie Joined: Wed Nov 12, 2003 12:12 pm Posts: 2 Location: Sweden Hello, I get the following error when trying to create a many2many relation (it works fine when I run it in my JUint test, but not when I run it in a JBoss 3.2.3: java.sql.BatchUpdateException: ORA-00001: unique constraint (DF_MT.XPKASSIGNED_DRIVER) violated The code I am running is: Code: private void ...

59. Confused! Need advice on mapping multiple 1-to-n relation    forum.hibernate.org

Hi, First, as a newbie in Hibernate, I'd like to thank all the people here - this is one of the best open-source sites I've seen - well documented and questions get answered quickly. I've been able to solve many issues with the initial setup and test without posting a single question. I'm building an attachment handling module for my application ...

60. many-to-many relation for subclass -    forum.hibernate.org

Hello all Excuse my english . Could you help me with this issue? Hibernate version 2.0.3 ...

61. problems with many to many relation and nested query    forum.hibernate.org

I have these two classes defined in hibernate User{ String username; List groups; } Group{ group_id; } "select elements(users.groups) from User as users" works fine, but what I'm trying to do is trying to get all the users in the same group as a certain user. How would i do something like that in HQL. My best guess so far has ...

62. How can I obtain the same object widh different relations    forum.hibernate.org

Hi I have two methods that have the purpose to obtain the same class but with different levels of relationship. For example I the first method returns just the object A but the second methods returns object A with relationship B. Is there another way of doing this that is not lazy initialization? I'm using Hibernate 2.1. Thanks for the help ...

63. How can I obtain the same object widh different relations    forum.hibernate.org

Hi I have two methods that have the purpose to obtain the same class but with different levels of relationship. For example I the first method returns just the object A but the second methods returns object A with relationship B. Is there another way of doing this that is not lazy initialization? I'm using Hibernate 2.1. Thanks for the help ...

64. Error deleting with a n-m relation    forum.hibernate.org

Hi, I have a Man class that contains a Set ou House class. The House class also contains a Set of Man class. So there is a n-m relationship between Man and House that goes both way, which means there is a relationship table between Man and House that stores Man.id and House.id. If I declare the in Man mapping:

65. I have a problem with one-to-many relation. Any hints    forum.hibernate.org

Hi, i have a problem with one-to-many relation. I always have to store first the child object, if not do that and try to store the parent with the child without explicit store the child it throws a Exception. Which says SQL insert, update or delete failed (row not found). Is that not possible that i can store a relation as ...

66. Problem with multiple many-to-one relations in the parent.    forum.hibernate.org

Good Morning I am using Hibernate 2.1.2 with Spring 1.0RC1 and SQLServer 2000. I have a domain object HealthInsurance which has 2 attributes of type of MedicalInsurance. The mapping has entries ------------------------------------------------------------------- ------------------------------------------------------------------- When I try to "save" a newly created HealthInsurance object ...

67. Parent / Child Relation ship ????    forum.hibernate.org

Hi All, I have to design a Data Access Service using hibernate. My case is something like this: I have a Category table (and a category object ofcourse). The Category can have many subcategories and the subcategories can have their own subcategories. Also Category and subcategory are represented by the same table and hence the same object. The table has many ...

68. Firebird1.5 many-to-one relation    forum.hibernate.org

Hi! I have an address table and a department table. The department should have always one address. I insert first the address, after that i assign the address to the department, than i try to insert the department, but i've got an error saying that the addressid(department foreign key to address table) is null. In debug i see that the address ...

69. Firebird 1.5 many-to-one relation problem once again:(    forum.hibernate.org

Hi! I have an address table and a department table. The department should have always one address. I insert first the address, after that i assign the address to the department, than i try to insert the department, but i've got an error saying that the addressid(department foreign key to address table) is null. In debug i see that the address ...

70. elements query in many-to-many relation    forum.hibernate.org

Hello! I have Data Type Unknown exception when trying to query elements of the collection: query is List news = session.find(" from NewsDocument doc where ? in elements(doc.players)", player.getId(), Hibernate.LONG); class is: public class NewsDocument { private Long id; private String header; private Set players; /** * @return * @hibernate.set * lazy = "true" * inverse = "false" * table = ...

71. many-to many relation with attributes    forum.hibernate.org

You can't simply specify attributes for a set. Create a new POJO class that represents the attributes of your relationship, for example, CategoryLink, with all the properties. Then, map it with a and a that has and . This changes the lifecycle semantics slightly, but you should be able to figure that out.

72. Many to 1 relation -- will this generate parent sql    forum.hibernate.org

Hi, If there are two tables as A, B and A is the parent of B -- so in the hibernate mapping for A i maintained a collection of B with lazy loading as true . In the mapping file of B i had a "many to 1" relation so that i can navigate it to parent from child. My question ...

73. what the relation between hibernate and amber ?    forum.hibernate.org

I have used resin for a while . And i like resin for its lightweight and easy to use. now when i upgrade to 3.0, i found it has a persistence model called 'amber' : "Amber is identical to Hibernate's persistence model. Classes designed for Hibernate can be used for Amber without modification" I have ever used hibernate with jboss. Now ...

74. what the relation between hibernate and amber ?    forum.hibernate.org

Recently i have tried resin ,which is a wonderful app server, and i found amber which is said " it is identical to Hibernate's persistence model. Classes designed for hibernate can be used for amber without modification" . well does it mean we donot need to use hibernate if we use resin ? regards!

76. how can i describe the relation!!!    forum.hibernate.org

77. can I use unique key for relation    forum.hibernate.org

I hope I don't ask a stupid question. Hibernate recommend seperating object id and business key,for example, a product has a auto-generate id and a unique product serial No. Here is the question: I and my colleagues are beginners for hibernate,in a recent project,I stick to the foreign key is referenced by id(auto-generate id),but one of my colleagues argues that we ...

78. One-to-One Relation mapping with foreign key association    forum.hibernate.org

Newbie Joined: Mon Jan 12, 2004 7:05 am Posts: 16 i have defined a one-to-one relationship between person and address with foreign key association , but in the database there is no address_id inserted with person, no person_id inserted with address either. Code: ...

79. one-to-one relation between two classes in the same table    forum.hibernate.org

Hi, I want, at the object level, to have some modularity but I have some problems to do it. I just want some advices on how I can achieve that. Here is an example of a class I have : Code: public class Person { private String name; private Integer customerNumber; ...

80. Problem: Attributes in relation-tables    forum.hibernate.org

Hi, I have some trouble mapping a existing database to hibernate. Currently there exists a set of tables looking like: table1: table2: relation1: it is a many-to-many-relation. Mapping the relation without the attribute is no problem, but i have no idea how-to add the attribute to the mapping. I am using a idbag to do the mapping. ----- ...

81. when are reverse relations be initilized?    forum.hibernate.org

Hi, I have a question about initialization of reverse relations in one-to-many relations. Example: public class A { Collection b; public Collection getB() { return b; } } public class B { A a; public A getA() { return a; } } Now I add an instance of class B to an instance of class A: A a=session.load((new A).getClass(),pkForA); B b=session.load((new ...

82. relations with attributes in hibernate?? (fuzzy relations)    forum.hibernate.org

Hello everybody, i need to model a qualified relation between objetcs. Say there exist classes A and B, and a fuzzy relation between those, say the 'is like' relation, so it will be an intermediate table to persist the values... tables: A 'is like' B ----- ------------ -------- 4,'a' 4, 1, 0.3 1, 'b' is there a way to model this ...

83. one-to many relation won't run SELECT query    forum.hibernate.org

Hey, I have 2 tables CustomerOrder and CustomerOrderLines. When I run my select query a get the following fault: net.sf.hibernate.QueryException: path expression ends in a composite value: customeror0_.id [SELECT co.customerNo, co.status, co.deliveryDate, col.orderLineNo, col.articleNo, col.articleName, col.price, FROM net.sf.hibernate.CustomerOrder co, net.sf.hibernate.CustomerOrderLine col WHERE co.id=col.id.countryCode AND co.id=col.id.customerOrderNo col.orderLineNo='181382'] What does Hibernate mean with path expression ends in a composite value: customeror0_.id? Mapping structure ...

84. Multiple Relations, Same Object.    forum.hibernate.org

I have a claim table that has patient_id and employee_id. Both of these links link to the patient table because the are identical, and in many cases the employee is also listed as the patient. So, in the patient class I would like to retrieve all the claims for the given patient, something like getClaims() I setup getClaimsAsEmployee and getClaimsAsPatient already: ...

85. one-to-many relations question    forum.hibernate.org

86. NullPointerException on one-to-many/many-to-one relations    forum.hibernate.org

Author Message ltcmelo Post subject: NullPointerException on one-to-many/many-to-one relations Posted: Thu May 27, 2004 3:22 pm Beginner Joined: Sun May 16, 2004 3:53 pm Posts: 47 Location: Belo Horizonte, Brazil Hi, i`ve posted scattered pieces of the problem i`m having. As i didn`t get solving answers and i didn`t post all the code, I`m trying this time (with all ...

87. Problem in one-to-one relation    forum.hibernate.org

88. delete-cascade a many-to-one relation    forum.hibernate.org

Hi there, I ran into a delete-cascading problem, then read the faqs, worked with some examples but still getting rid of it - so I decided to post a question in this forum, maybe somebody have had this problem before... I have a parent-child relation which does not delete the refering child database entries, and I really don't understand why nothing ...

90. Wrong numbers of log entries in N-N relations.    forum.hibernate.org

>Hibernate 2.11 + JBoss 3.2.3 + Postgres 7.4 Hi all, I have an N-N relation (with inverse collections and "save-update" in both directions) between "Grupo" (an group) and "Integrante" (an integrant that can be a a user or other group). This is resolved with a "GrupoIntegrante" table in a relational database. So, using this code: Code: ...

91. Ternary relation + cascade insert/save/update/delete    forum.hibernate.org

Hi all, I have a ternary relationship between classes A,B,C and the intermediate table D, that contains the three identifiers for classes A,B,C. From class A, I mapped the related objects BC by using a composite-element. ... ... ...

92. Modelling issue with ternary relation    forum.hibernate.org

Hi, I've been wrestling with a modelling issue for a couple of days and could really use some insight / tips from others. Here's the situation: I've got three entities in an online game: Club, Player and Round. A Player can play for a Club in one or more Rounds. The tables look like this: TABLE player: - id INTEGER(10) unsigned ...

93. many to many relations between objects of the same class    forum.hibernate.org

I have a design/best practice question. My app that uses a entity table with a many to many relationship to itself. For example, my entity table is for a 'Word' object. A synonym relationship table relates a word to another word. I have successfully implemented a many-to-many relationship using a set, but it only works one way. If my relationship table ...

95. Hibernate behaviour with many-to-many relations    forum.hibernate.org

Hi all. I am facing a behaviour with Hibernate that I don't fully understand. Given this basic client code: Code: 1. SessionFactory sf = config.buildSessionFactory(); 2. Session sess = sf.openSession(); 3. Transaction tx = null; 4. CD cd = new CD(); //CD is a basic POJO // ... set some properties on the POJO // CD and ARTIST tables have a ...

96. one-to-two relation    forum.hibernate.org

Well, my solution is: Code: ...

97. objects relations    forum.hibernate.org

assume I have persistent class A that has association to persistent class B. Now assume that I want to delete class A instance corresponding data from storage but with out deleting class B data that is accociated with it and assume that the configuration file states that cacade value is "all", is there a dynamic way to say I want only ...

98. HSQL Between 2 tables without relation    forum.hibernate.org

How do i do a efficient HSQL join between 2 tables without specific relation in a mapping? I have 2 tables where i want to know the description on a table A with a field on a table B. Table A (fields) regnumberA description regdate Table B regnumberB stnumber regdate i want to know how i obtain de field description of ...

99. query with set relation    forum.hibernate.org

Hi, how do i resolve this problem, i want to do a query between 2 tables with this relation in my table A : and I create my criterias this: Criteria criterios = getSession().createCriteria(TmkCampania.class); if(parametros[0].trim().length()>0 && Integer.parseInt(parametros[0])>=0){ criterios.add(Expression.eq("clUnegocio",new Integer(parametros[0]))); } if(parametros[1].trim().length()>0 && Integer.parseInt(parametros[1])>0){ criterios.add(Expression.eq("flCampania",new Integer(parametros[1]))); criterios.createCriteria("archivoSet").add(Expression.eq("clTipoArchivo",new Integer(54))); criterios.createCriteria("archivoSet").add(Expression.eq("clTipoArchivo",new Integer(53))); Integer(53))); ...

100. parent-chield relation not by primary key    forum.hibernate.org

[b]Hibernate version:2.1.4[/b] How can I design following relation. I have parent table with fields id(PK),id2,... I have chield table with feilds id2(PK),id3(PK),fld1,fld2,... chield table should be linked with parent by id2 field (which is not Primary Key). how should be described relation in parent.hbm.xml I tried many combinations like this: