Cal VA
Weblog  
 
September 2004
S M T W T F S
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
<Aug Today Oct>
Search
Topics
Personal Personal
Java Java
Syndicate
Links
Referrers Today
   
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
   
 
 
 
 
 
 
 
   
 
 
 
 
 
God Bless America
 

The Posting
Sunday, September 19, 2004 Bag vs List in Hibernate

Learned a little this weekend - Bag vs List in Hibernate.  I was troubled since i really wanted to have a Java ArrayList in my object so i could index in my jsp and iterate over the list in an update form.  Using a Hibernate Set left me unable to index.  A Hibernate List left the Java ArrayList populated using the primary key - if the keys were 0,1,2,... that would have been ok.  But i only needed a few items from the database in my ArrayList and since the Hibernate List maintains the position of the object in the ArrayList equal to the position in the database the technique was leaving holes in my ArrayList of nulls.  Of course this was not what i wanted.  Now this may be explained in the documentation but after reading it twice i did not fully understand the Hibernate List.  Over the weekend i read the book Hibernate in Action and discovered the Hibernate Bag and it solved my problem.  I can use a Java ArrayList that is loaded simply by adding new objects to the beginning of the ArrayList.

posted at 1759 hrs



 
 
What's New
02/14 Baileys
02/07 Slideshow
10/20 Wyoming Vaca...
03/30 Mom and Dad ...
11/15 Cal Holman P...

New Pics
No New Pictures

Popular Pics
1 Baileys and Sweet...
2 Sweetpea and a Mo...
3 Sleepy
4 Vacation in Highl...
5 A Christmas Jacket
6 Washington Hall -...
7 42nd Street Subway
8 Sunrise in Manhattan
9 Little Post Office
10 Radio City at Chr...
11 Dinner in Monteverde
12 Sunrise in Manhattan
13 I Can't Believe Y...
14 Salis IT
15 Cozy Fire

Top Page Hits
1 GuestBook
2 ScrapbookSearch
3 blogging
4 SupportProjects
5


    Top Top    
java struts tomcat log4j DTDns MySQL Ant Apache