-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Is this a bug, or an I doing something wrong?
PostPosted: Tue Sep 06, 2005 4:40 am 
Beginner
Beginner

Joined: Wed Apr 13, 2005 2:03 pm
Posts: 34
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.0.5

I'm having trouble getting the new sessionStatistics stuff to work. In particular, I keep getting a java.lang.UnsupportedOperation whenever I try to invoke my session stats.

Here's my session factory creation where I turn stats on:

static {
fConfiguration = new Configuration().configure();
fSessionFactory = fConfiguration.buildSessionFactory();
fSessionFactory.getStatistics().setStatisticsEnabled(true);
}

Here's my session creation code where I actually create a session:

private static Session createNewSession() {
AuditInterceptor intercept = new AuditInterceptor();
Session s = fSessionFactory.openSession(intercept);
intercept.setSession(s);
s = (Session) (Proxy.newProxyInstance(Session.class.getClassLoader(),
new Class[] { Session.class }, new CorinnaSession(s)));
return s;
}

Here's the piece of code where I actually try to check my stats:

Session s = HibHelper.getSession();
SessionStatistics stats = s.getStatistics();
boolean foo = s.getSessionFactory().getStatistics().isStatisticsEnabled();
if (foo)
int x = stats.getCollectionCount();
return stats.getEntityCount();

Here's the top of the stack trace I keep getting:

org.hibernate.util.IdentityMap.keySet(IdentityMap.java:162) org.hibernate.stat.SessionStatisticsImpl.getCollectionCount(SessionStatisticsImpl.java:25)
forms.AdminActions.getEntityCount(AdminActions.java:20)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

Here's what my (3.0.5 copy I think of the relevant org.hibernate.util.IdentityMap.keySet() source looks like:

public Set keySet() {
// would need an IdentitySet for this!
throw new UnsupportedOperationException();
}

So, it's pretty obvious where the exception's coming from e.g. Hibernte is throwing it because that's literally the only think that method could ever possibly do.

My question though is can sesionStats be made to work? Is there some combination of voodoo and snake oil I can invoke which won't take me down this particular code path? Or do session stats just not work in 3.0.5?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 7:25 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I did fix that in CVS last month

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 11:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Yes, it is fixed in 3.1 beta 2.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.