-->
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.  [ 9 posts ] 
Author Message
 Post subject: BUG in 2.1rc1
PostPosted: Thu Dec 04, 2003 11:34 am 
Beginner
Beginner

Joined: Mon Sep 08, 2003 6:52 am
Posts: 46
Hiya I've been using 2.0.3 for some time, but I wanted some of the new 2.1 features, and
so I downloaded 2.1rc1 and have been trying that out.

Unfortuneately it doesn't work.

I've tracked it down to the use of the the <menta> element inside a <component> element.
I use this to set the name of the generated class - I actually submitted a patch to the DTD that
makes this legal - the class generator already worked.

Anyway, the problem is in Binder.java in the method bindComponent.

in 2.0.3 we had the following:

...
Iterator iter = node.elementIterator();
while ( iter.hasNext() ) {

Element subnode = (Element) iter.next();
String name = subnode.getName();
String propertyName = getPropertyName(subnode);
String subpath = path + StringHelper.DOT + propertyName;
...

In 2.1rc1 we now have:
...
Iterator iter = node.elementIterator();
while ( iter.hasNext() ) {

Element subnode = (Element) iter.next();
String name = subnode.getName();
String propertyName = getPropertyName(subnode);
String subpath = StringHelper.qualify(path, propertyName);
....


The problem is in the propertyName string. When there is a <meta> tag, propertyName
is null. This was okay in the 2.0.3 version, because subpath worked okay.
But in 2.1rc1 the StringHelper.qualify method takes the length of both strings,
which causes an NPE if one of the strings is null.

I don't mind coding up a patch, and sending it in, but I'm wondering what the better approach is:

should I fix StringHelper.qualify to check for nulls, etc? If so, what should I return?

Or am I better off putting a check in bindComponent:

if ("meta".equals(name))
continue;

If I do the second one, it would probably be good to do a test case that tests for
things like that, but I'm currently under a bit of a time crunch and don't know that I will
have time in the next week to do that properly.

Any thoughts? I'm going to slap in the second one for the moment, just so that I can continue.
If people would rather me do the first approach, that's fine too.

Once some form of concensus has been reached, I'll submit a patch.

Cheers,

H


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 11:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
This is already fixed in CVS.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 11:50 am 
Beginner
Beginner

Joined: Mon Sep 08, 2003 6:52 am
Posts: 46
gavin wrote:
This is already fixed in CVS.


Okay good. As it turns out, doing "ant jar" on a freshly un-packed 2.1rc1 doesn't work!!

148 retnuh@candy:~/stuff/hibernate/hibernate-2.1 $ ant clean jar
Buildfile: build.xml
[taskdef] Could not load definitions from resource clovertasks. It could not be found.

cleantestdb:

clean:

splash:

init:
[echo] Build Hibernate-2.1 (2003-12-04 03:37:21)
[mkdir] Created dir: /home/retnuh/stuff/hibernate/hibernate-2.1/build
[copy] Copying 45 files to /home/retnuh/stuff/hibernate/hibernate-2.1/build

compile:
[javac] Compiling 547 source files to /home/retnuh/stuff/hibernate/hibernate-2.1/build
[javac] /home/retnuh/stuff/hibernate/hibernate-2.1/src/net/sf/hibernate/mapping/Association.java:6: no interface expected here
[javac] public abstract class Association extends Value implements Fetchable {
[javac] ^
[javac] /home/retnuh/stuff/hibernate/hibernate-2.1/src/net/sf/hibernate/mapping/CollectionValue.java:9: no interface expected here
[javac] public class CollectionValue extends Value {
[javac] ^
[javac] /home/retnuh/stuff/hibernate/hibernate-2.1/src/net/sf/hibernate/mapping/IntegerValue.java:7: no interface expected here
[javac] public class IntegerValue extends Value {
[javac] ^
[javac] /home/retnuh/stuff/hibernate/hibernate-2.1/src/net/sf/hibernate/cache/CacheTest.java:63: release(java.lang.Object,net.sf.hibernate.cache.CacheConcurrencyStrategy.SoftLock) in net.sf.hibernate.cache.CacheConcurrencyStrategy cannot be applied to (java.lang.String)
[javac] ccs.release("foo");
[javac] ^
[javac] /home/retnuh/stuff/hibernate/hibernate-2.1/src/net/sf/hibernate/cache/CacheTest.java:101: release(java.lang.Object,net.sf.hibernate.cache.CacheConcurrencyStrategy.SoftLock) in net.sf.hibernate.cache.CacheConcurrencyStrategy cannot be applied to (java.lang.String)
[javac] ccs.release("foo");
[javac] ^
[javac] /home/retnuh/stuff/hibernate/hibernate-2.1/src/net/sf/hibernate/cache/CacheTest.java:112: release(java.lang.Object,net.sf.hibernate.cache.CacheConcurrencyStrategy.SoftLock) in net.sf.hibernate.cache.CacheConcurrencyStrategy cannot be applied to (java.lang.String)
[javac] ccs.release("foo");
[javac] ^
[javac] 6 errors

BUILD FAILED
file:/home/retnuh/stuff/hibernate/hibernate-2.1/build.xml:151: Compile failed; see the compiler error output for details.

Total time: 6 seconds


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 12:16 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
eh??

works fine for me ... what JDK?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 12:23 pm 
Beginner
Beginner

Joined: Mon Sep 08, 2003 6:52 am
Posts: 46
gavin wrote:
eh??

works fine for me ... what JDK?


I have no idea what happened. I've just unapcked it fresh, and it worked.

Very strange, I don't know what went wrong.

H

P.S. Any idea when the next release is going to be?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 12:25 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
P.S. Any idea when the next release is going to be?


late next week.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 12:42 pm 
Beginner
Beginner

Joined: Mon Sep 08, 2003 6:52 am
Posts: 46
gavin wrote:
Quote:
P.S. Any idea when the next release is going to be?


late next week.


Sorry to be irritating about this, but for some reason I still cannot get Hibernate 2.1 working.
I was using the JCS caching, but now it all blows up.

I've added the following to hibernate.cfg.xml

<property name="hibernate.cache.provider_class">net.sf.hibernate.JCSCacheProvider</property>

But I am getting the following:

2003-12-04 16:36:27,598 [HttpProcessor[8080][4]] INFO hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment,
use of process level read-write cache is not recommended)
2003-12-04 16:36:27,665 [HttpProcessor[8080][4]] INFO hibernate.cfg.SettingsFactory
- Use scrollable result sets: true
2003-12-04 16:36:27,665 [HttpProcessor[8080][4]] INFO hibernate.cfg.SettingsFactory
- JDBC 2 max batch size: 15
2003-12-04 16:36:27,666 [HttpProcessor[8080][4]] INFO hibernate.cfg.SettingsFactory
- echoing all SQL to stdout
2003-12-04 16:36:27,666 [HttpProcessor[8080][4]] INFO hibernate.cfg.SettingsFactory
- Query language substitutions: {}
2003-12-04 16:36:27,666 [HttpProcessor[8080][4]] INFO hibernate.cfg.SettingsFactory
- cache provider: net.sf.hibernate.JCSCacheProvider
2003-12-04 16:36:27,681 [HttpProcessor[8080][4]] FATAL foneblog.environment.ConnectionState - Error trying to configure Hibernate:
net.sf.hibernate.HibernateException: could not instantiate CacheProvider: net.sf.hibernate.JCSCacheProvider
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:115)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1078)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724)
...


Is there some other special setup? Is there a page describing what steps need to be
taken migrating from 2.0 to 2.1?

Cheers,

H
at com.newbay.foneblog.environment.ConnectionState.<clinit>(ConnectionState.java:30)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 12:50 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
net.sf.hibernate.cache.JCSCacheProvider


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 12:52 pm 
Beginner
Beginner

Joined: Mon Sep 08, 2003 6:52 am
Posts: 46
gavin wrote:
net.sf.hibernate.cache.JCSCacheProvider


mea culpa, mea cupla...

H


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 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.