1. can't save associated tables forum.hibernate.orgHi, maybe it was asked before, but I can't find it. My problem is, that I have 2 tables which are linked by a foreign key. Nothing special on it. Both tables have auto_increment enabled. The mapping files are generated by Middlegen (MiddlegenIDE and MyEclipse 3.0). But when I populate my model objects and try to save it, I get an ... |
2. Want to associate two objects with same session forum.hibernate.orgHi, I am working on an complex object graph in a detached session. I need to associate already saved object more than once in this graph because of multiple user interaction. So evertime i get a new from database with different java identity but same database identity. Now i want to save this object graph by opening a new session . ... |
3. Associate objects via a Map of Sets forum.hibernate.orgHi, Does anyone know how to associate, in Hibernate, to two classes via a map of sets: SortedMap |
4. Help on mapping an associated table to a (Hash)Map forum.hibernate.orgHibernate version: 3.0.5 Name and version of the database: MySql 4.1.10a / Oracle 9i I am trying to use a database scheme which is maintained by a third-party application. therefore I cannot change the scheme in any way - besides creating custom views. there are two tables "Tickets" and "TicketsCustomFields". both tables are used to describe an object "ticket". the "Tickets" ... |
5. Accessing objects associated with other session forum.hibernate.org |
6. Accessing objects associated with other session forum.hibernate.org |
7. Can't find solution for "Illegal attempt to associate a forum.hibernate.orgHello, in Company class if I used @hibernate.set table="globalmkt_contact" lazy="true" and I got: Failed to lazily initialize a collection - session is disconnected. and if I set lazy="false" I got "Illegal attempt to associate a collection with two open sessions" Exception. Hibernate version:2.1.7 Mapping documents: ------------Company.hbm.xml-------------------------------------------- |
8. illegally attempted to associate a proxy with two open Sessi forum.hibernate.orgI am having a horrible time with hibernate updating the database of an existing record. I am using struts, and have an action form and a value object. When I first open a record from the database, I create my value object. Here is my code in my DAO for getting the record. Code: Incident incident = (Incident) HibernateUtil.getSession().load(Incident.class, rbNumber); ... |
9. Trouble persisting associated child classes forum.hibernate.org |
10. specifying join behavior for associated classes forum.hibernate.org |
11. Problem querying associated table set of string elements? forum.hibernate.orgI can run querys of the main table of the database just fine however Im running into some trouble trying to query associated tables, in this case specifically the associated strings element table called scholarshipXmajor. Hibernate version: hibernate-3.0.5 Mapping documents: |
17. Collection is not associated with any session forum.hibernate.orgAuthor Message timrobertson100 Post subject: Collection is not associated with any session Posted: Fri Jan 13, 2006 6:16 am Regular Joined: Wed Jun 29, 2005 11:14 pm Posts: 119 Location: Kbenhavn Hibernate version: 3.0 Mapping documents: Code: |
18. Got id of associated class - what's best way to use? forum.hibernate.orgHi, For my question assume the following: A player is always on one team A team consists of 1..* players Suppose I have a team id and I want to create a new player. There is already a team associated with the id, but I don't need anything from team in this case except for the id. Don't worry about how ... |
19. Problem on Query criteria for associated objects forum.hibernate.orgHi, I am new to Hibernate. Having trouble in using "Example.create" I have a scenario where i have to put criteria for associated object. I tried using "Example.create". But it is returning wrong results.This is what I did. I have 1 parent class called "Master". 1 child class called "Child". Inside the Child class I have reference to Master.For putting criteria ... |
20. question about disjunction between 2 associated objects forum.hibernate.orgHi, I am using Hiberate 2.1.8 and criteria api to write a search screen. I think Criteria API is good in this scenario by avoiding a lot of dynamic hql concatenation. But now I tried to do something like: Object A contains Object B (you can get B by A.B) A has an attribute name B has an attribute title A ... |
21. newbie : Trying get associated groups in Set, Urgent! forum.hibernate.orgMy User class has a Set of groups. In the table of course there are multiple rows representing this association, however when I select all users I want to consolidate all groups in one single Set. Following is the information about my class and mapping file. I am faily new in ORM space, just started a week back and have deadline ... |
22. Find by Example and associated classes forum.hibernate.org |
23. When object is saved to db, associated object is not saved forum.hibernate.orgAuthor Message Rajmohan Post subject: When object is saved to db, associated object is not saved Posted: Thu Feb 16, 2006 7:26 am Newbie Joined: Thu Feb 16, 2006 6:43 am Posts: 5 Location: Bangalore, India Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: Hibernate Version 3.1 Mapping documents: Person.hbm.xml |
24. Lazy Initialization for One to Many associated coll size = 0 forum.hibernate.org |
25. How to prevent delete of object with associated objects? forum.hibernate.orgHibernate version: 3.0 Mapping documents: Code: |
26. Problem associated One To Many to inherited entity forum.hibernate.orgHibernate version:3.1 Beta Name and version of the database you are using:oracle 9i I have an entity called "SCHOOL", which is associated (ONE TO MANY relation) to an entity called "STUDENT" that inherited from the abstract entity called "PERSON". The code of the entities is like this: The Person entity: @Entity @Table(name="PERSON") @Inheritance(discriminatorValue="1", strategy=InheritanceType.SINGLE_TABLE, discrimunatorType=DiscriminatorType.INTEGER) @DiscriminatorColumn(name="TYPE") public abstract class Person imlements ... |
27. can't figure out how to fetch associated Set forum.hibernate.orgI thought the following code would return a list containing one Person, with that Person havig his set of addresses populated: Code: session.createCriteria(PersonImpl.class).setFetchMode("addresses", FetchMode.JOIN).add(Expression.eq("socialSecurityNumber", theSocialSecurityNumber)).list(); Instead I get as many Persons as there are addresses for that person. That is, instead of getting one Person holding a set of three addresses, I get a list containing three Persons, each with the ... |
28. Order results on property of associated entity forum.hibernate.org |
29. Criteria for associated collection property forum.hibernate.orgHibernate version: 3.1 I have two domain classes Physician and Speciality with a many-to-many relationship. A Physician contains a Set of Speciality. I want my user to select one or more Speciality and with these i want to construct a query with the Criteria API to search for all Physician objects that contain the specified Speciality(s). I think i need to ... |
30. Owner not associated with session forum.hibernate.org |
31. Session.find() pull associated objects from DB? forum.hibernate.orgI have an issue with the session.find() method that I'm not sure how to fix. In my application, I have Object_A and Object_A_Association. They are mapped to their respective tables TABLE_A and TABLE_A_ASSOC. The mapping doc for Object_A_Association is straightforward and the mapping_doc for Object_A has an association with the Object_A_Association, i.e.: Code: |
32. Criteria: Query on associated collections forum.hibernate.orgHi, i am currently searching for a solution of a problem with the Criteria API of Hibernate 3.2: I have the following mapping: Class A references a Set of class B. Class B is an abstract class and has different extensions (B1, B2, ...). The inheritance is mapped via joined subclass using a discriminator. All extensions of class B contain different ... |
33. Illegal attempt to associate collection with two sessions forum.hibernate.orgHi, I need convert content one database into other. I have built SessionFactory from Configuration loaded from first config xml. I have opened session and loaded all objects. Then I have built second SessionFactory from Configuration loaded from another config xml (the second datasource). When I want save beans, exception is thrown. Bean contains Set collections. Why it is doesn't work? ... |
34. Criteria with restriction on associated object's property forum.hibernate.orgHi. I'm trying to execute a Criteria query which filters the root entity using fields contained in it's many-to-one associated objects. It should be easy to do but, I got strange errors. My database looks like this: Student table has FK that references Group table Group Table has FK that references Teacher table. Theese two associations are mapped as many-to-one in ... |
35. Query with dynamic criterias for associated collection. forum.hibernate.orgHibernate version: 3.0.5 I want a HQL which finds all movies with specific categories. There is a many-to-many mapping between a Movie and a MovieCategory Movie: ... |
36. Sorting by field in associated obj without losing null vals forum.hibernate.org |
37. How To Associate many to many forum.hibernate.org |
38. problem in one-to-many associate to a class that is subclass forum.hibernate.orgHi all, here in my case, an EupNode class owns a set of EupNodeProvRelation, which was a subclass of NodeProvinceRelation. there are two sublasses of NodeProvinceRelation, another is IsmpNodeProvRelation, they share one table using a discrimator . The problem I met was, when I get a EupNode, by associated reference to the set of nodeProvRelation, I will get all the NodeProvinceRelation ... |
39. Indirectly persisting the state of associated objects forum.hibernate.orgNeed help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp 3.1.2 [Oracle 9.2 Hi all, This is more of a general question. Its probably pretty obvious, and I'm totally missing the point, but I searched the forum for similar stuff and didn't find anything, which probably means I'm really bad at searching ;) I'm wondering if it is correct to do ... |
40. Can not update a recor: object already associated forum.hibernate.orgHi I am not able to update a record into mysql. After the update method is executed, the record remains unchanged. I do not have any problem in inserting a new record. I have checked the table and the primary key is properly defined. Following are the details of the problem: Mapping documents: |
46. A challenge. How best to associate classes to themselves? forum.hibernate.org |
47. Restrict criteria to subclass of associated object forum.hibernate.orgCriteria critT; Criteria critTG; // Thing critT = getSession().createCriteria(Thing.class); // Thing Group critTG ... |
48. Hibernate EventListener for change to associated entities forum.hibernate.orgHi all. I'm trying to write a Hibernate EventListener that is called not just when the properties of an entity change, but also when a set of associated entities changes. The situation is that the contents of an association's PersistentBag are being modified during the session, and then the entity is being saved. At this point there is no callback to ... |
49. Hibernate basic associate forum.hibernate.org |
50. Unable to persist associated objects forum.hibernate.orgHello, I get the exception below when trying to persist an associated object that is added to an existing object. The parent object is called Service and the associated object is called ServiceConfig. I have pasted the code below for the respective objects and their maps Hibernate version: 3.2.3 Mapping documents: |
51. Unable to persist associated transient objects forum.hibernate.orgpublic class TestHibernate { public static void main(String[] args) { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); Item item = new Item(); item.setName( "Painting IX" ); ... |
52. Criteria Queries - more then one associated Object with AND forum.hibernate.orgHi, Problem: I have to get all objects from Database via Criteria Queries, that contains any objects in a collection. If it's one object or a disjunction its not a problem. But how do i create a conjunction? Example: An User-Object has roles as Set. I want to get a list of all users, who have the roles 'Admin' AND 'Originator'. ... |
53. How To Fetch Associated Entities Mapped With Any Element forum.hibernate.orgHaving avoided the use of the |
54. sorting based on field in associated object? forum.hibernate.orgI'm trying to work out a query that will sort its results based on the value of a field in an object associated with the objects returned by the query. The model classes are these: Code: public class Person { private Long id; private User recruitedBy; } public class User { private ... |
55. collection is not associated with any session forum.hibernate.orgHibernateException: collection is not associated with any session I'm getting this error message on the deployment server but not the development machine. Does this mean anything to anyone? The code where it dies looks like this: Query query = session.createQuery( "FROM FooState WHERE Foo_ID=" + this.getFooID()); log.debug("before"); List |
56. Illegal attempt to associate a collection with two open sess forum.hibernate.org |
57. collection is not associated with any session. forum.hibernate.orgHi all, I am trying to fetch one map but I am getting the following Exception: org.hibernate.HibernateException: collection is not associated with any session [java] at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:449) [java] at org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:784) [java] at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:229) [java] at org.hibernate.loader.Loader.loadCollection(Loader.java:1985) [java] at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36) [java] at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565) [java] at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60) [java] at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716) [java] at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344) [java] at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86) [java] at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:109) [java] at org.hibernate.collection.PersistentBag.size(PersistentBag.java:225) [java] ... |
58. Illegal attempt to associate a collection with two open sess forum.hibernate.orgDear Friends, I'm from Argentina and I'm a beginer english student, I'll try to explain my problem with hibernate, sorry for my english!! =P Well, I have one abstract class called "Region"a and this class has three subclass "Country" , "State" and "Location". This classes has de same basic properties (id, name) inherit from "Region" , but Country have a Collection ... |
59. Query problem with a constructor receiving associated entity forum.hibernate.orgpublic class Product{ ... private Photo photo; public Product(String id, ... , Photo photo){ ... this.photo=photo; } @OneToOne @JoinColumn(name="DEFAULT_PHOTO_ID") public ... |
60. how to associate objects directly to a joined-subclass obj forum.hibernate.org |
61. illegally attempted to associate a proxy with two open Sess. forum.hibernate.orgHi, this is very long time to post here, i'm facing error while updating a custom class(pojo) object with update method of hibernate session. I explain you structure of all classes. I have an Engine which made by 10-20 classes to calculate data. I get a new session when entering in engine and after that i maintain that session through out ... |
62. Sort by associated map values forum.hibernate.orgFirst off, thanks for the question. For some unknown reason I kept thinking about this for hours and I actually could sort out a couple of things on the way. Anyhow, it's hard to come to an HQL that is able to do this due to a couple of HQL limitations, for some of which I have no explanation and I ... |
63. Entity associated with 2 other entities of same row fails forum.hibernate.org |
64. Fetching associated object only once. forum.hibernate.orgI have a scenario, in which I want to load my associated object only once for many other objects. For Example, I have following kind of code in my hbm file. |
65. intercepting changes on associated objects ? forum.hibernate.orgHellu all, I like to intercept the changes on an associated object, but don't know how. Example: Person has a collection of adresses. The addresses are value type objects. I want to change the date created/date updated fields in the address, just before they are updated in the db. In the hibernate interceptor the onSave method get called whenever Person is ... |
66. Illegal attempt to associate a collection with two open sess forum.hibernate.orgI have the delete method: public boolean deleteCustomerByCustomerId(long customerId) { Session session=getHibernateTemplate().getSessionFactory().openSession(); session.delete(getCustomerByCustomerId(customerId)); return true; } and the getCustomerByCustomerId method is: public TblCustomerInfo getCustomerByCustomerId(long customerId) { Session session=getHibernateTemplate().getSessionFactory().openSession(); StringBuffer hql=new StringBuffer("from TblCustomerInfo where customerId=:customerId"); Query q=session.createQuery(hql.toString()); q.setParameter("customerId", customerId); return (TblCustomerInfo)q.uniqueResult(); } When i call the delete method it give me a error:Illegal attempt to associate a collection with two open sessions ... |
67. illegal attempt to associate a collection with two open sess forum.hibernate.orgNewbie Joined: Thu Jul 03, 2008 9:29 am Posts: 2 Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version:3.1 Database: Oracle 10 Hello all, I have read up on this error through multiple posts but I am still not sure how to overcome this problem in my application. I load an object using Hibernate to view on a ... |
68. how to change the associated object to a new one forum.hibernate.orgHi, I have a one-to-one bidirectional association on foreignkey with cascade=all in parent. I have attached an orphan object to the parent (child's parent object is null) while saving to the session. Now after this, I want change this association to a new transiant object and persist this new object not deleting the orphan. But some how this is not happening. ... |
69. Query an associated map with Criteria API forum.hibernate.org |
70. Illegal attempt to associate a collectionwithtwoopensessions forum.hibernate.orgWhen I run my application with single thread, it is going fine. When I am testing the same application with multiple users using Load Runner for performance testing, I am getting the following error. My Sample code is as follows: saveItems() { session = HibernateUtil.getSessionFactory().openSession(); session.setFlushMode(FlushMode.MANUAL); tx = session.beginTransaction(); //delete the old entries from the database. List |
71. illegally attempted to associate a proxy with 2 open Session forum.hibernate.orgHibernate: version 3 (hibernate3.jar) DB: mysql5.0 Problem: illegally attempted to associate a proxy with two open Sessions I'm trying to update a table in the database using the session and I get the exception "org.hibernate.HibernateException: illegally attempted to associate a proxy with two open Sessions" In each of my class I use a getSession() from a utility class called HibernateUtil to ... |
72. Collections Order by associated table column forum.hibernate.orgHibernate 3.2 I have 2 tables which have a many-many relation via a mapping table. I need to sort the collection based on the column ina ssociated table. I have read that hibernate Orderby does not support that. What could be a workaround? Tables - BM->BM_REPORT ->Report BM Report is my mapping table. I need to sort by the Report_ID column ... |
73. SELECT and GROUP BY an associated entity forum.hibernate.org |
74. Returning a Collection with a Subset of an associated collec forum.hibernate.orgHibernate version: 3.3.1 - i.e no dereferencing .... Name and version of the database you are using: MySQL 5.0.45 Hi, I'm after assistance with generating a query. I have a Parent Object "Shape" with a specific name and which has within it a set of "Circles" each with a description. I'd like to do a search with one input box, where ... |
75. How to get every methods which associated with an Object forum.hibernate.org |
76. Illegal attempt to associate a collection with two opensess forum.hibernate.orgHi While using unidirectional one to many associations ( using a set ), we are getting error as : org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions during update operation ( after doing a select using the same session ) . Please let me know the reason to this & solution ASAP. Thanks Nisha |
77. TransientObjectException: proxy was not associated with the forum.hibernate.orgHello experts, we have a problem with hibernate inside JBPM, but we believe that is more a hibernate problem than a JBPM problem. We have a class accessing the hibernate session from the jbpm context. Most of the time the method is executed correctly, but randomly the method throws a "TransientObjectException: proxy was not associated with the session". See below the ... |
78. Illegal attempt to associate a collection with two open sess forum.hibernate.orgI am trying to access the find() function and then trying to delete() i get this error. com.jiva.pojo.DataAccessLayerException: org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions at com.jiva.pojo.AbstractDAO.handleException(AbstractDAO.java:337) at com.jiva.pojo.AbstractDAO.delete(AbstractDAO.java:189) at com.jiva.pojo.CampaignsDAO.delete(CampaignsDAO.java:56) at com.jiva.web.CampaignsActionController.deleteHandler(CampaignsActionController.java:114) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:369) at org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:325) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:139) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:717) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:658) ... |
79. Illegal attempt to associate a collection with two open sess forum.hibernate.orgBeginner Joined: Mon May 26, 2008 3:34 am Posts: 31 Hi everyone, First of all i am working with the session per request pattern. I also have an interceptor for logging purposes, that persists an event everytime i insert/update an object. When i insert an object everything works fine, but when i get an object and try to make an update, ... |
80. How to persist object that is associated with persisted obj? forum.hibernate.orgHello I have a class Client that has a ManyToMany relation with Address. I'm trying to persist a client1 object that has an address1 and after that persist client2 that has the same address1. So hibernate creates one row to client1, one to client2 and two rows for address1. I want it to create one row for the address1. I'm using ... |
81. Get object by associated one forum.hibernate.org |
82. Get object by associated one forum.hibernate.org |
83. Update query won't stop using selects on associated objects! forum.hibernate.orgLets setup the question first. What I have is >4 tables: Customer, Address, Order, OrderItems. Each are mapped using Hibernate Annotations and accessed through a Spring DAO/Services layer. What I am trying to do is merge duplicate customers together. So all that really needs to happen is all orders and addresses associated with customer B, need to update their customer_id foreign ... |
84. collection is not associated with any session forum.hibernate.orgI created a class called UserGroup. UserGroup is a self-join. The root has its own sub-UserGroups and sub-UserGroups have its own children. Code: @Entity @Table(uniqueConstraints = {@UniqueConstraint(columnNames = {"groupName"})}) public class UserGroup extends BusinessObject { private String groupName; private UserGroup parent; private List |
85. Illegal attempt to associate a collection with two open sess forum.hibernate.orgAuthor Message vladostivistic Post subject: Illegal attempt to associate a collection with two open sess Posted: Wed Jul 08, 2009 10:47 am Newbie Joined: Wed Jul 08, 2009 10:26 am Posts: 2 Hi, I am currently trying to use hibernate (without spring) on my server in order to store contract in my database. Unfortunately, i have an issue with ... |
86. How to retrieve the table name associated with an entity forum.hibernate.orgHi, I'm using hibernate3 and implementing the PreUpdateEventListener to get notified when updates occur. The next aim is to insert a record of the update into Audit tables. For this need to know the table name that the updated entity is mapped to. How do I retrieve the table name. Synopsis of my code public final class HibernateAuditLogListener implements PreDeleteEventListener, PreInsertEventListener, ... |
87. Illegal attempt to associate a collection with two open sess forum.hibernate.orghi all! I am using hibernate and spring and all my DAOs extend HibernateDAOSupport. I have an entity 'Order' which contains an attribute 'Quote' and Quote contains collections of 'Buy' and 'Sell' values. |
88. Filtering a collection on an associated class. forum.hibernate.orgHi, I've been searching around and trying for a little while to sort this out. I'm trying to filter a collection of objects on a field that is on a class (table) referenced from the objects in the list. I have: Code: @Entity @Table(name="metadata") public class MetaData implements Cloneable { ... private int ... |
89. Ordering by attribute of associated entity forum.hibernate.orgThanks, but it is not, what I wask asking about. This annotation only causes, that all childs in collection will be ordered. What do I need is to order in criteria query by attribute of associated entity (e.g. order childs by age of their mothers), as I'm describing in my first, original post. |