initialization 1 « Core « JPA Q&A





1. hibernate: LazyInitializationException: could not initialize proxy    stackoverflow.com

Here's one that has me perplexed. I'm trying to implement a basic Hibernate DAO structure, but am having a problem. Here's the essential code:

 int startingCount = sfdao.count();

 sfdao.create( sf );

 SecurityFiling ...

2. How to solve lazy initialization exception using JPA and Hibernate as provider    stackoverflow.com

I am working on a project for a customer who wants to use lazy initialization. They always get "lazy initialization exception" when mapping classes with the default lazy loading mode.

@JoinTable(name = "join_profilo_funzionalita", ...

3. How to import initial data to database with Hibernate?    stackoverflow.com

When deploying applications, I often use Hibernate’s capacity to create database schema in order to simplify the deployment. This is easily achievable by configuring hibernate.hbm2ddl.auto property. However, on occasion I also ...

4. hibernate lazy initilization problem    stackoverflow.com

I want to manage a Transaction in my persistence layer, But when I try to fetch the results lazily I get this error:

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of ...

5. Grails and Hibernate's Lazy Initialization Exception    stackoverflow.com

Where are the most common places where you've gotten an org.hibernate.LazyInitializationException in Grails, what was the cause and how did you solve it ? I think this one exception comes up a ...

6. Hibernate lazy initialization exception    stackoverflow.com

I am trying to create an application using spring mvc and hibenate. I have been seeing the exception failed to lazily initialize a collection of role for nearly two days now ...

7. hibernate post initialization    stackoverflow.com

I would like to initialize class members of a persisted object as soon as Hibernate loads the object from the database. How can I do this ? More specifically: In the following persisted ...

8. Could not initialize proxy - No Session again    stackoverflow.com

I get these error log when viewing a page

ERROR [TP-Processor11] (LazyInitializationException.java:42) - could not initialize proxy - no Session
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
    at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:132)
 ...

9. How to deal with database initialization?    stackoverflow.com

As also described here, I'm trying to determine the best way to initialize and update my application's database. I use EclipseLink-JPA2. I distribute a NetBeans platform application. Considered options:

  • use create-tables ...





10. How to get HSQLDB to emit error messages during initialization of a datasource from a .script file?    stackoverflow.com

I am working on a Java application that will use some Hibernate (annotated by JPA) classes, backed by a HSQLDB datasource (DBCP BasicDataSource). I am trying to manually tweak the ...

11. Filter Lazily Initialized Hibernate Collection    stackoverflow.com

This might be a super easy answer, since I'm sure it's not uncommon. I see some similar questions, but nothing that seems to describe my problem. I have two objects: a ...

12. Lazy lookup of a dictionary value using a stateless session    stackoverflow.com

In my app, I set up a ternary dictionary mapping so that for a given user, I can retrieve "settings" for each instance of an object that belongs to the user. ...

13. Hibernate: will merge work with many-to-one object transtively?    stackoverflow.com

Hi I know that and tested before merge will reattach the object back to session preventing lazy initialization exception when object is no longer in session. a.) So I have a ...

14. Hibernate: Partial lazy initialization?    stackoverflow.com

I have a many-to-many association defined like: Parent.hbm.xml:

    <set name="children" table="child_parent_map" lazy="true">
        <cache usage="nonstrict-read-write" />
        ...

15. Testing if a grails property is lazy/not initialized?    stackoverflow.com

I can't seem to test if an object is lazy initialized. What am I doing wrong here?

public void testLazy(){
   User lazyUser = User.withCriteria {
      ...

16. How do I use eager Instantiation in Hibernate?    stackoverflow.com

<!-- Clasa Proiect-->
<class catalog="tema3" name="com.tema3.tables.Proiect" table="proiect" lazy="false">
    <id column="proiect_id" name="id">
        <generator class="native"/>
    </id>
    <property name="nume" ...





17. Is lazy="false" the only solution for “org.hibernate.LazyInitializationException: could not initialize proxy – no Sessionâ€?    stackoverflow.com

“org.hibernate.LazyInitializationException: could not initialize proxy – no Session“ was giving me a lot of pain. Some of the old thread of stackoverflow has discussions about this particular problem. I followed those ...

18. Architecture to avoid Hibernate LazyInitializationExceptions    stackoverflow.com

I am in the beginning of my project. So I am trying to design an architecture which avoid Hibernate LazyInitializationExceptions. So far my applicationContext.xml has:

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property ...

19. Hibernate Lazy initialization problem    stackoverflow.com

while learning a bit about hibernate i came across famous lazy initialization exception under below mentioned case i have a class A which has reference to another class B and using hibernate ...

20. remove objects from hibernate session    stackoverflow.com

I have hibernate pojo class A { B b ; some other properies} with lazy= true for class B. When i get object A, B is not loaded and hibernate returns its ...

21. Struts2 + JPA - Lazy Initialization During View Generation    struts.1045723.n5.nabble.com

I'm currently using Struts2 in a project that is utilizing the Java Persistence API (JPA, specifically Hibernate) with container managed transactions (CMT). To access the Persistence layer, a layer was created using SLSBs as "service" objects which provide simple " getById( int )" and "List<> gets()" type methods. The Struts2 Actions use these beans (by injection (provided by some ...

22. bootstrapping hibernate initialization    coderanch.com

Hello, Does anyone know of a mechanism within hibernate that would allow some type of callback to occur once all the mapping files have been read in? I need to know whe a certain type of object has been read in so I can map that class type. I don't want to write my own custom class loading that would do ...

23. what is lazy initialization in hibernate    coderanch.com

Hi Ajay, when u use hibernate u can make lazy=true or lazy=false. I think this comes into play only when u deal with one to many or many to many relationships in database. if u mentioned lazy=true and u call from a company bean like Collection x = company.getAllEmployees(); x will be empty; if u mentioned lazy=false x will contain the ...

25. avoiding initialization of hibernate objects    coderanch.com

Hi, I have an application where we use hibernate and the transaction management is a lil messed up. We have a HibernateHelper class from which we open and close the hibernate session. We use Weblogic workshop 9.2 . Now we make calls from the controller to Hibernate Helper(which is of course in the dao layer) to get a session instance. Now ...

26. Hibernate Lazy initialization Exception    dbforums.com

I am facing problem with Hibernate Lazy initialization. I tried to make lazy=true in mapping file, to improve the performance of the site. without turning it to true, entire object tree is getting loaded into memory. Following are the steps I followed 1. I made lazy=true for all classes, and the associations which each class possess. -> I got LazyInitializationException: could ...

27. Hibernate Lazy Initialization exception solved by Long Session    zkoss.org

However to my surprise lot of (previously unknown) troubles with lazy loading occurred. I tried OpenSessionInView design pattern, but it helped only a little (master list and detail form on selected row - list is loaded in first request, detail in update detail contains lazy loaded collection). After some study I found, that Toplink essentials load data from lazy collection ...

28. Hibernate lazy initialization exception caused by ZK listitem    zkoss.org

I am currently trace into the system to identify how the spring + zk + hibernate causing lazy initialization exception although we include OpenSessionInView listener and TransactionSynchronizationManagement in zk.xml and web.xml. The problem i found is causes by the number of query called. For instance, I have 22 records in the list item, however, it will only called up to 20 ...

29. Basic Initialization issue    forum.hibernate.org

Hi I am new to hibernate. I am using the HibernateUtil class as below: Code: public class HibernateUtil { private static final SessionFactory sessionFactory = buildSessionFactory(); private static SessionFactory buildSessionFactory() { System.out.println("Did not enter the try block"); try { ...

30. PersistentBag forces initialization upon access?    forum.hibernate.org

I am working with a very large object graph and thus all of my relationships are lazily loaded. This works quite well, except when dealing with collections. It seems that while Hibernate maps lazily loaded collections with a PersistentBag (I'm using annotations and explicitly marking all relationships as FetchType.LAZY). This is what I expect. However, I'm getting errors when accessing the ...

31. Lazy Initialization exception    forum.hibernate.org

Well, if your goal is to dynamically change if a collection is loaded lazily or not, well, I don't know any way of doing it. You can just create a couple of methods. Mark the association as lazy, and then have an eagerFetch method that just calls the getter for the list, which will force a loading of the association, essentially ...

32. lazy initialization problem, Please help    forum.hibernate.org

Author Message supratim Post subject: lazy initialization problem, Please help Posted: Fri Feb 19, 2010 4:17 am Newbie Joined: Thu Feb 18, 2010 8:35 am Posts: 3 Hi All, I have these two access classes Code: package comm.dao; import org.hibernate.*; import javax.persistence.*; import comm.utils.*; import org.apache.commons.logging.*; import org.hibernate.criterion.Restrictions; import org.hibernate.Query; import comm.models.*; import java.util.List; public class AuthorDAO { ...

33. Hibernate Lazy Initialization issue discussion    forum.hibernate.org

Newbie Joined: Sat Mar 20, 2010 8:32 pm Posts: 3 I read the below article. Why couldn't any Hibernate folks answer all these. After all, the LazyInitialization Exception is such a huge issue. Hi! Today I was reading: Why can't Hibernate just load objects on demand? I find some of its affirmations interesting (I realize this is kind of a sensitive ...

34. @Loader @NativeNamedQuery and lazy initialization issues    forum.hibernate.org

@NamedNativeQuery(name = "activeB", query = "select b.* from A a inner join B b on b.a_id = a.id where b.a_id = ? and b.status_id = 1", resultSetMapping = "activeB") @SqlResultSetMapping(name = "activeB", entities = { @EntityResult(entityClass = B.class) }) ... @OneToMany(mappedBy = "a", fetch = FetchType.EAGER, cascade = CascadeType.ALL) @Sort(type = SortType.NATURAL) @Loader(namedQuery = "activeB") public Set getBs() {...}

35. General client-/serverhandling with lazy-initialization    forum.hibernate.org

Newbie Joined: Tue Jan 15, 2008 6:26 am Posts: 8 Hi @all, I currently get the impression, that I have not yet understood one of the key-concepts of Hibernate. Maybe someone can help me out a little bit. I have the current scenario, that Im running a client-server-web-application using hibernate 3 together with Spring 2.5. The persistence-context is NOT set to ...

36. Unable to force initialization of proxy objects - SOLVED    forum.hibernate.org

Newbie Joined: Thu Oct 14, 2010 2:10 pm Posts: 2 Hi, I'm brand new to Hibernate so sorry in advance if this a stupid question. I have included code that seems relevant - happy to provide any additional items that might be helpful in determining a solution. I have to write a mock web application that manages university course enrollment. There ...

37. HibernateSessionWrapper initialization problem.    forum.hibernate.org

hi, I am trying to deploy my application on jboss with jdk 1.6, as soon as i try to get the first data return (User) retrieveObj( "from User u1 where Userid = :p1 and u1.userStatus = 'A'", "p1", Userid); I get the error of: java.lang.NoClassDefFoundError: Could not initialize class com.eaton.electrical.cpa.util.HibernateSessionWrapper Can someone tell me as to what could be the issue ...

38. Hibernate initialization exception    forum.hibernate.org

Hi, I must say first that I am new to Hibernate and the code on which I am working is not written by me. I am trying to configure an application, the server component of whose uses Hibernate to communicate with the database. I have changed the config files to suit the configurations in my machine. When I do a maven ...

39. JBoss hangs on database initialization    forum.hibernate.org

I have an ear application, packaging a war and jboss seam and an EJB bean. The Seam is only used for scheduling. I use Hibernate, JPA 1.0, JBoss 5.1.0.GA and Oracle 11. During deploy, the JBoss hangs at the following lines: Code: 2011-06-20 13:20:35,140 INFO [org.jboss.jpa.deployment.PersistenceUnitDeployment] (HDScanner) Starting persistence unit persistence.unit:unitName=cs_ft.ear/lib/FT-DB-JPA-1.0-SNAPSHOT.jar#be.cs_ft.impl_FM-DB-JPA 2011-06-20 13:20:35,390 INFO [org.hibernate.cfg.annotations.Version] (HDScanner) Hibernate Annotations 3.4.0.GA ...

40. Lazy initialization happening when it should not.    forum.hibernate.org

Author Message DavidNDuffy Post subject: Lazy initialization happening when it should not. Posted: Wed Sep 10, 2003 11:02 pm Senior Joined: Sun Aug 31, 2003 3:14 pm Posts: 151 Location: Earth (at the moment) I am getting absurd proxy usage from reasons I can't begin to fathom. I apologize that I have not posted a "main method" to JIRA ...

41. lazy initialization question...    forum.hibernate.org

I have read the documentation and i think i am doing something that is not permitted. I have in my mapping xml file specified to use lazy initialization, i also have a set definition in the mapping file for a one-to-many class. What i am trying to do in my code it return, or keep in memory after i close the ...

42. HQL and lazy initialization    forum.hibernate.org

43. Question: about Lazy Initialization    forum.hibernate.org

44. Lazy Initialization: many-to-one    forum.hibernate.org

45. How does lazy initialization really work?    forum.hibernate.org

46. one-to-one with lazy initialization    forum.hibernate.org

47. Error with lazy initialization in 1-m relationships cached    forum.hibernate.org

Hi! We are trying to cache our one-to-many relationships with JCS (by adding to xml file). The problem is that second time I try to load relationships instances (first time I havent any problem) I get this message: " Could not initialize proxy - the owning Session was closed " In adition, we are using lazy initialization. We havent ...

48. Lazy initialization questions    forum.hibernate.org

Hello, How does lazy loading of collections work across sessions? I have an object that I load in one session using session.find(....); It has several collections that are defined with the lazy="true" attribute. In another transaction, I want to be able to access certain (but not all) of the lazy collections. I do the following: // open the session session.save(myObject); // ...

49. Lazy initialization and Proxying    forum.hibernate.org

Suppose you have an Employee class and every employee has a set of Skills associated with him. This set may be large enough (say every employee has about 50 skills). In the Employee class mapping you write: Code:

50. One-to-one with lazy initialization    forum.hibernate.org

51. Lazy initialization    forum.hibernate.org

Hi, There is no Lazy initialization for many-to-one and one-to-one. So what happens is the properties which have this attribute gets queried even if not required. I think that this pose a serious problem. Coz I have this jsp which displays data from different table. Since they have got many-to-one and one-to-one relationship they get queried again and again. Does anyone ...

52. How to enable lazy initialization for one-to-one    forum.hibernate.org

I have a one-to-one association. I am using Hibernate 2.1. Whenever I get the parent (one-to-one), Hibernate gets also the child (many-to-one). I set outer-join="false" but this did not solve the problem. Is it possible to get the parent, without getting the child, in one-to-one association. If so how? Thank you, mota

53. Remote lazy initialization in a client-server app    forum.hibernate.org

Hi all, I have tried to figure out from the other postings what is the proper way to use lazy init in a client server architecture. I want to have a (possible) thin client who gets DTOs from a server via J2EE session beans. I would prefer that only the server be aware of the persistence(Hibernate). Now, if I want to ...

54. How to disable Lazy initialization in the presentation layer    forum.hibernate.org

Upon getting a composite value object in my presentation layer with a particular set of one-to-many mappings I would like to have the value object no longer attempt to lazily initialize a collection, but return null if not populated. Is there a way to do this in Hibernate? Is there a disable method or a clone method? or do I have ...

55. Remote lazy initialization in a client-server app    forum.hibernate.org

Hi all, I have a client -server app, they talk via EJB session beans. The client gets/sends domain objects from/to the server and only the server interacts with the DB via Hibernate. The question is, how to retrieve lazy collections in the client? Can I open a session, get lazy collection and close the session in the client? I suspect this ...

56. Exception when adding obj to col. during lazy initialization    forum.hibernate.org

Problem: With bidirectional relationships, if you do not update both sides in your object model, you might have an object tree that is not consistent with the Database. (See [url]http://www.hibernate.org/Documentation/InsideExplanationOfInverseTrue[/url] Solution: Update child and parent at the same time as follows: In the child: [code] public void setParent(Parent parent) { // Do something only if parent changes. if (this.parent != parent) ...

57. Lazy initialization accross multiple sessions    forum.hibernate.org

I have a graph with many levels of parent-children. I modeled this graph with lazy initialization. I need to load the top part of this graph in one session, modify it when necessary, and if needed load other sets of children in new subsequent sessions. At the end I cascade-update the whole graph. Hibernate documentation specifies: "The lock() method allows the ...

58. Application initialization    forum.hibernate.org

Hello. I'm having problems when initializing my application. I'm using Hibernate 2 and HSQLDB (hipersonic db). Things seems to go well but, when it displays the message: INFO: Use scrollable result sets: true it stops and does nothing. What it should be? A piece (that might be useful) of the code of the application files comes below. Thanks. ------hibernate.properties------- hibernate.dialect net.sf.hibernate.dialect.HSQLDialect ...

59. initialization hangs with 2.1.1 in weblogic 8.1    forum.hibernate.org

Hi, I was using 2.0.3 in weblogic 8.1 environment with no problems however when I upgraded to version 2.1.1 the initialisation never gets past the following line in the log - net.sf.hibernate.cfg.SettingsFactory - Query language substitutions: {no='N', true=1, yes='Y', false=0} net.sf.hibernate.cfg.SettingsFactory - cache provider: net.sf.hibernate.cache.HashtableCacheProvider net.sf.hibernate.cfg.Configuration - instantiating and configuring caches and it simply hangs at that point. The only changes ...

60. lazy collection initialization    forum.hibernate.org

Author Message andy999 Post subject: lazy collection initialization Posted: Tue Jan 13, 2004 9:27 pm Newbie Joined: Wed Dec 10, 2003 8:40 pm Posts: 14 Location: Sydney hibernate: 2.1.1 jboss: 3.2.1 mysql: 4.0.13 spring: 1.0m4 Hi, I' m wondering if anyone could tell me where I'm going wrong? I'm loading in a Company object with two collections - contacts ...

61. Lazy initialization problem    forum.hibernate.org

Hi, I've a business object which contains a set and this set is configured as lazy loading. My test class looks like this (pseudo code): public class Testclass { protected Session session = null; protected Iterator iterator; Testclass { // initialize session and iterator; the iterator iterates over my business object } public static void main() { // use the iterator ...

62. SortedMap and Lazy Initialization    forum.hibernate.org

63. Lazy Initialization across Sessions    forum.hibernate.org

I've been reading up on some of the topics regarding lazy initialization and I wanted to summarize the topic to see if I have a correct understanding of how lazy initialization works: Object 'A' (which has a reference to object 'B') is loaded in a session. At that point a Proxy for object 'B' is created and "set" on Object 'A'. ...

64. Is an open session required for lazy initialization?    forum.hibernate.org

I have a mildly deep object graph (5 levels), comprised of aproximately 200 objects total. I have a tree control for browsing this heirarchy. When I launch my tree viewer, I only want to see the root nodes. With SQL tracing on, I see that I'm getting the entire object graphs loaded as a result of my session.find(). I have proxies ...

65. Lazy initialization of byte[] properties    forum.hibernate.org

Quote: Hi, everyone. I'm using hibernate v. 2.1. and I'm implementing a mailing system, with message sending/receiving - just like an usual e-mailing system. The message entity has a set of attachments, which has some properties like filename and mimetype, and a property called contents. This property (contents) returns or sets a byte[] from a blob. Because this system is web ...

66. Using Oracle view shows lazy initialization exception    forum.hibernate.org

Hello, I have created a oracle view by combaining 2 tables. (i had hard time to join these 2 tables in hibernate to create a map. I must be doing something wrong). Anyway, i got the view, i got the map created out of that view and i got the java object created. Here is my map

67. Controlling lazy initialization of connected objects    forum.hibernate.org

Hi everyone, we've got here a big data model with around 100 tables. They are *highly* interconnected. So as the java app grows and maps more and more tables we end up with dozens of objects when loading even the most simple object. I believe it's the *spirit* of O/R mapping to have your whole schema loaded in memory and at ...

68. Strange lazy initialization exception.    forum.hibernate.org

Experts, after spending long hours resolving my problem and seraching in the forum I decided to post my problem. I am using struts and hibernate in my web app with 'Open view with session pattern'. I have filter that closes the session when response is rendered. I am trying to iterate over my lazy collection, but whenever I do that it ...

69. Lazy Initialization in multi tier application    forum.hibernate.org

There is a known problem to initialize an object from a lazy collection after the session was committed. I successfully solved this problem in Hibernate 1.2. by rewriting cirrus.hibernate.proxy.LazyInitializer class. In initialize() method I open a new session, get an object and commit the session. I am going to move to version 2.1, are there some issues to solve the problem ...

70. saveOrUpdateCopy & lazy initialization exception    forum.hibernate.org

hi, when i try to use saveOrUpdateCopy, i've been getting a lazy initialization exception. the object that i'm trying to create has been added to a parent's collection which was loaded in another session. how can i correct this error, do i have to manually associate the parent object to the session with this method? thanks, cam Code: net.sf.hibernate.LazyInitializationException: Failed to ...

71. Lazy Initialization in Collection and Session    forum.hibernate.org

I have a class A, with a Set of references to class B (using lazy initialization) In Session X, I get dataobject a (class A). Then, session X is closed. Later I open a new Session Y, and I try to iterate the references to class B in dataobject a. Lazy initialization exception (no session or session closed) throw. I would ...

72. Chapter 12.1. Proxies for Lazy Initialization    forum.hibernate.org

Why the documentation of Hibernate reccomend to use the class for Lazy Initialization and not the interface? Infact: "The mapping file declares a class or interface to use as the proxy interface for that class. The recommended approach is to specify the class itself" (Chapter 12.1) But in the same Chapter 12.1 there are 4 reason to use Interface: 1. "Firstly, ...

73. outer join lazy initialization    forum.hibernate.org

Hello, I have 3 tables A --- one to many --- B ---one to many ---C (they are related by Set collection) I have the outer join turned off and lazy = true at global level. For specific instances however, I do need to load all the related collections B and C if I query for A. The HQL query that ...

74. How to force Lazy Initialization?    forum.hibernate.org

75. collection initialization problem    forum.hibernate.org

Newbie Joined: Mon May 31, 2004 12:44 pm Posts: 1 Hi everybody, I use Hibernate 2.1.2 and have a little beginner's problem. In my class Election are three Sets of one-to-many relationships (Voters, Authorities and Choices). When I try to retrieve the complete election data from the database (MySQL 3.2.3) there is just one object in each Set. Hibernate retrieves just ...

76. Proxy initialization    forum.hibernate.org

Hi, I have a question regarding the initalization of collections and associtation marked as lazy and proxied. Say I have an object with two collections that I need to initalize. I can load one using eager loading with the initial object load, and then call Hibernate.initialize on the other collection. However, if the objects in the second collection have proxied associations, ...

77. Problems with Lazy initialization    forum.hibernate.org

I've been trying to access a lazy initialized set from a class. If I didn't understood wrong, hibernate was supposed to take care about bringing from the database the objects when I called the getSet of the Business Object. I don't know if I'm missing something here, I created a series of interfaces so the rest of my system layers could ...

78. Data initialization    forum.hibernate.org

Hi, I have some metadata stored in tables, and this data is constantly accessed, sometimes by graph navigation, other times by HQL. I want to load all the data and build the relationship graph. I would like everything cached so hibernate doesn't have to go to the database for these classes. I'm talking about 5 classes, with relationships to each other. ...

79. Data initialization    forum.hibernate.org

Hi, all. I'm a newbie of hibernate... I have some POJOs, and use xdoclet to create mapping tables. Some of the POJOs are seed data, so I want to use xml to propagate the initialization data into the database. I guess this kind of task is really a common one... and I don't want to reinvent the wheel. Does anyone know ...

80. Hibernate addToXXX lazy initialization problem in 3 tier app    forum.hibernate.org

Hi guys, I am developing a 3 tier app (struts, ejb, hibernate). now the problem is that i have a parent - child relationship where i retrieve the parent object in the ejb and transfer that object to struts, now when i am in struts, i create many child objects and want to add to these child objects to the parent ...

81. lazy initialization on properties    forum.hibernate.org

I was wondering if there was a way to have the fileData property lazy (instead of the whole class). That way i could show a file list and only retrieve the fileData when needed. The mapping is below: Hibernate version: 2.1.6 Mapping documents: true

82. Lazy collection initialization fails when using cache    forum.hibernate.org

Author Message Ville Peurala Post subject: Lazy collection initialization fails when using cache Posted: Mon Oct 11, 2004 6:55 am Newbie Joined: Fri Oct 08, 2004 11:59 am Posts: 16 Location: Helsinki, Finland Hello, I wonder why lazy one-to-many collection initialization fails when the "parent" object comes from cache. If I have a one-to-many relation (the collection type is ...

83. Bi-directional relationships and lazy initialization    forum.hibernate.org

Hibernate version: 2.1.6 I have a situation where I have a one-to-many bi-directional relationship like this (abbreviated): Code: A User class that has a lazy relationship to portlets:

84. one-to-one lazy initialization example using primary keys    forum.hibernate.org

Author Message jwisard Post subject: one-to-one lazy initialization example using primary keys Posted: Thu Oct 21, 2004 11:08 am Beginner Joined: Tue Oct 19, 2004 11:04 am Posts: 22 I have noticed that there have been several unsatisfied requests for an example of one-to-one relationships that can be lazily loaded. After much trial and error, I have come up ...

85. Lazy Initialization Failure    forum.hibernate.org

I'm trying my hand at lazy initializing for the first time and got this exception. There is a session open in my method GroupActions.doAddPages(). Thanks, Karl Code: SEVERE: Failed to lazily initialize a collection - no session or session was closed net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection - no session or session was closed at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:209) ...

86. Collection Initialization Problem    forum.hibernate.org

Beginner Joined: Thu Oct 23, 2003 11:22 am Posts: 20 I have a 4 level set of parent child relationships that look essentially the same. The classes involved are Job, Run, Target and Spec. The parent child relationships are Job->Runs, Run->Targets, Target->Specs. The collection is a unidirectional (except for Job->Runs) list structure. I have a recursive method that copyCount() that gets ...

87. Lazy Initialization Strategies?    forum.hibernate.org

Yeah, that's where I was sort of heading, but now I'm starting to wonder if it's really worth it anymore to even use lazy initialization. Recursing a graph that could potentially become very large is expensive, and probably more so then not using lazy initialization. Another tact might be to just lazy initialize primary nodes of the graph and then turn ...

88. lazy initialization exception after attaching an object    forum.hibernate.org

I have a problem on this source code: new UtenteDAO().makePersistent(utente); Set set = utente.getNormativeSegnate(); results = new java.util.ArrayList(); for(Iterator it = set.iterator(); it.hasNext(); ) { Normativa n = (Normativa)it.next(); results.add(it.next()); n.getArgomento().getDescrizione(); //EXCEPTION!! } makePersistent perform an update on utente. The session is active...so that collection is not detached and lazy initialization shouldn't be a problem! Why this happens?

89. EHCache initialization error    forum.hibernate.org

java.lang.NullPointerException at net.sf.ehcache.config.Configuration$DefaultCache.access$100(Configuration.java:305) at net.sf.ehcache.config.Configuration.getDefaultCache(Configuration.java:128) at net.sf.ehcache.CacheManager.configure(CacheManager.java:158) at net.sf.ehcache.CacheManager.(CacheManager.java:127) at net.sf.ehcache.CacheManager.create(CacheManager.java:179) at net.sf.ehcache.CacheManager.getInstance(CacheManager.java:195) at net.sf.ehcache.hibernate.Plugin.(Plugin.java:92) at net.sf.ehcache.hibernate.Provider.buildCache(Provider.java:89) at net.sf.hibernate.cfg.Configuration.configureCaches(Configuration.java:1107) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:767) at net.buildercom.retriever.hibernate.SessionUtil.(SessionUtil.java:27) at net.buildercom.retriever.hibernate.User.login(User.java:366) ...

90. Query cache and lazy initialization    forum.hibernate.org

Author Message mperham Post subject: Query cache and lazy initialization Posted: Mon Dec 06, 2004 11:22 pm Newbie Joined: Thu May 06, 2004 8:14 pm Posts: 18 Hibernate 2.1.6 with DB2 8.1.4 We are trying to use a query cache for a set of methods which query tables frequently. We are finding cases where with the query cache enabled ...

91. Collection proxy initialization    forum.hibernate.org

Newbie Joined: Sun Apr 11, 2004 2:25 am Posts: 9 Hibernate version: Hibernate 2.1.6 Mapping documents: Code: ...

92. Design recommendations on lazy initialization sought    forum.hibernate.org

Suppose you have two objects A and B. There is a one to many relationship between A and B. Both A and B are created using the code generator. Object A has a "public A getBs()" method and reverse lookup for both A and B is set to true. In A.hbm.xml lazy initialization for the set of Bs is set to ...

93. Collection initialization and session.flush()    forum.hibernate.org

but this is not true for in this case: SLSB + CMT (business logic)+ DAO (persistance) bean method calls several DAO methods and container commiting tx after that. but if first DAO call creates object, second - updates it... I'm using Steve Ebersole's ThreadLocalSession which is fine for nested calls, but not appropriate for "parallel" ones

94. How to set lazy initialization to false?    forum.hibernate.org

Thank you for responding. Climate is the top object and it fails when trying to iterate through SkyConditionList bag. I have bunch of other classes and all of them are a joined subclasses. I don't have a problem with lazy initialization for those classes. It seems only for Climate when I try to traverse to the SkyCondition

95. suppress initialization logging    forum.hibernate.org

I have tried tweaking the log4j properties everyway I know how and I can't get the initialization from logging on hibernate startup. I am running inside the springframework if it makes a difference. It is the biggest issue when running junit tests. Lots of extra logs that I don't really want to see. When starting up I get about 30 pages ...

96. Auto Collection Filter on Lazy Initialization    forum.hibernate.org

I'm using hibernate 2.1. Say I have three tables: Person (identifier, name) Group (identifier, groupname) GroupMemebership ( person_id, group_id, year) What I am trying to say is that A person was in a particular group for only a specified year. For example a person might be in an "Undergraduate Student" group in 2004 and a "Graduate Student" in 2005. But both ...

97. Problem with association initialization    forum.hibernate.org

Hibernate version: 2.1.8 Mapping documents: I have 2 classes (A and B) and two associations between A and B (A<->B and A->B). A(1)<->(*)B (bidirectional one-to-many) A(*)->(1)B (singledirectional many-to-one) All associations are lazy loaded. Code between sessionFactory.openSession() and session.close(): In my transaction I get one object of class A (I use Session.get()). I also initialize A(1)<->(*)B association (on the side of class ...

98. question about Hibernate initialization    forum.hibernate.org

Newbie Joined: Thu Mar 10, 2005 11:40 pm Posts: 5 Location: ZhongShan,China I am a new Hibernate User,when I use Hibernate 3 JbuilderX Sqlserver2000 Database and It give me following infomation: INFO DriverManagerConnectionProvider:147 - cleaning up connection pool: jdbc:jtds:sqlserver://localhost:1433/myShield;charset=GBK my hibernate.cfg.xml as following: org.hibernate.dialect.SQLServerDialect net.sourceforge.jtds.jdbc.Driver sa 123 ...

99. Best design for common "initialization" code    forum.hibernate.org

Yes, that's one approach. In simple applications I've used the same filter for both the Open-Session-In-View and the initialization, with configuration ocuring during static initialization of the filter. In practice, configuration can be a pain and for large scale applications an IOC container like Spring or HiveMind can be very helpful in configuring Hibernate.

100. On-demand initialization using proxies in multi-tier apps?    forum.hibernate.org

The problem of using Hibernate - or any ORM tool using lazy initialization for that matter - in a multi-tier architecture which physically separates the persistence tier from the presentation tier seems to be an inexhaustible well of debate. In Hibernate's Wiki, Steve Ebersole describes a solution using DTOs specifically tuned to the needs of the application at hand. As a ...