Hi,
Thank you for the reply. Here is the log that I am receiving when I save out an Organization (which I do first):
Code:
28 Sep 2009 20:23:36,908 DEBUG http-8080-3 org.hibernate.pretty.Printer - listing entities:
28 Sep 2009 20:23:36,908 DEBUG http-8080-3 org.hibernate.pretty.Printer - com.jcnet.vo.Organization{titleFontSize=24, id=1, users=null, title=null, subtitleFontSize=16, description=Test Organizations, name=Test, subtitle=null, percentageAdded=10.0, dollarsAdded=0.0, accessCode=TEST}
28 Sep 2009 20:23:36,914 DEBUG http-8080-3 org.hibernate.transaction.JDBCTransaction - committed JDBC Connection
28 Sep 2009 20:23:36,914 DEBUG http-8080-3 org.hibernate.jdbc.ConnectionManager - aggressively releasing JDBC connection
28 Sep 2009 20:23:36,914 DEBUG http-8080-3 org.hibernate.jdbc.ConnectionManager - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
28 Sep 2009 20:23:36,914 DEBUG http-8080-3 com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@4e39f16f [managed: 10, unused: 9, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@180fb0b0)
28 Sep 2009 20:23:36,923 DEBUG pool-2-thread-1 org.hibernate.search.backend.impl.lucene.PerDPQueueProcessor - Skipping usage of an IndexReader for updates
28 Sep 2009 20:23:36,924 DEBUG pool-2-thread-1 org.hibernate.search.backend.impl.lucene.PerDPQueueProcessor - Opening an IndexWriter for update
So first, you can see accessCode is definitely being set to the organization. Then when I create the user, I get the following bit of log:
Code:
28 Sep 2009 20:24:00,317 DEBUG http-8080-3 org.hibernate.pretty.Printer - listing entities:
28 Sep 2009 20:24:00,317 DEBUG http-8080-3 org.hibernate.pretty.Printer - com.jcnet.vo.User{id=1, lastName=Jones, organization=com.jcnet.vo.Organization#1, emailAddress=test@test.com, firstName=Bob, password=2f855926454df7a805a020d569b98281, userType=com.jcnet.vo.UserType#1}
28 Sep 2009 20:24:00,318 DEBUG http-8080-3 org.hibernate.transaction.JDBCTransaction - committed JDBC Connection
28 Sep 2009 20:24:00,318 DEBUG http-8080-3 org.hibernate.jdbc.ConnectionManager - aggressively releasing JDBC connection
28 Sep 2009 20:24:00,319 DEBUG http-8080-3 org.hibernate.jdbc.ConnectionManager - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
28 Sep 2009 20:24:00,319 DEBUG http-8080-3 com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@4e39f16f [managed: 10, unused: 9, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@180fb0b0)
28 Sep 2009 20:24:00,319 DEBUG pool-1-thread-1 org.hibernate.search.backend.impl.lucene.PerDPQueueProcessor - Skipping usage of an IndexReader for updates
28 Sep 2009 20:24:00,321 DEBUG pool-1-thread-1 org.hibernate.search.backend.impl.lucene.PerDPQueueProcessor - Opening an IndexWriter for update
Again, you can see the organization is being set on the User object here. I never get anything more than those last two lines for the index there.
As far as indexing code goes, I am "automatically" indexing on the save. Here is my save code though:
Code:
public static void saveDataObject(DataObject object)
{
Session session = HibernateUtils.getSession();
Transaction tx = null;
try
{
tx = session.beginTransaction();
tx.setTimeout(3);
session.saveOrUpdate(object);
tx.commit();
}
catch(final Exception exception)
{
if(tx != null)
{
tx.rollback();
}
session = HibernateUtils.forceSession(object);
try
{
tx = session.beginTransaction();
tx.setTimeout(3);
session.saveOrUpdate(object);
tx.commit();
}
catch(final RuntimeException e)
{
if(tx != null)
{
tx.rollback();
}
throw e;
}
}
finally
{
session.close();
}
}
Is there anything else I should do to write the index out further?
Yes, I actually tried @ContainedIn late last night and edited my forum post. Didn't effect this problem though:
Code:
@OneToMany(mappedBy="organization")
@ContainedIn
private List<User> users;