-->
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.  [ 8 posts ] 
Author Message
 Post subject: error- failed searching database
PostPosted: Tue Feb 03, 2004 5:03 pm 
Beginner
Beginner

Joined: Tue Jan 27, 2004 10:59 am
Posts: 24
This error -

" failed searching database [query=from d in class class com.dynetics.vidrds.model.Driver order by employeeID]
java.lang.NullPointerException"

occurs when my code has this snippet:
public Singer findSingerByEmployeeID(String employeeID)
throws Exception {
final String QUERY =
"from s in class " + Singer.class +" where s.employeeID = ?";


Wondering what the error is....


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 03, 2004 6:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Really not enough info, show more code. Note that the HQL syntax you are using is very deprecated.[/list]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 03, 2004 9:36 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
That exception message does NOT come from Hibernate, it comes from your own code. So I conclude that you should do MUCH more digging and testing before posting here again. TIA


Top
 Profile  
 
 Post subject: Hibernate using two different schemas/databses
PostPosted: Wed Feb 04, 2004 6:49 pm 
Beginner
Beginner

Joined: Tue Jan 27, 2004 10:59 am
Posts: 24
I dug further to see that my code is trying to access tables(actually objects) in two different databases.
My question is:could there be conflicts in trying to persist objects in this scenario....


Top
 Profile  
 
 Post subject: Re: Hibernate using two different schemas/databses
PostPosted: Wed Feb 04, 2004 8:11 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
samy wrote:
My question is:could there be conflicts in trying to persist objects in this scenario....

You have to be more specific in your use case

_________________
Emmanuel


Top
 Profile  
 
 Post subject: more code attached
PostPosted: Wed Feb 04, 2004 9:03 pm 
Beginner
Beginner

Joined: Tue Jan 27, 2004 10:59 am
Posts: 24
my junit test has a setup method which tries creating the two objects below-(TestVehicle and Vehicle)using hibernate.
Vehicle is in database1 and TestVehicle in database2.
HibernateAdapter is the persistent class for the first one and hWHibernateAdapter is for the second class.

the skeleton code in these adapter classes is:

my error occurs at:factory.openSession();

JUnit code:

protected void setUp() {



this.vehicle =
new Vehicle(this.vin, variant, null, null, this.group);
this.vehicle.setOwner(this.customer);
HibernateAdapter.saveObject(this.vehicle);
dtestId1 = new DurabilityTestID("dtestID1");
DurabilityTest dtest1 = new DurabilityTest(dtestId1);
vehicle1 = new TestVehicle(testVehicleID1, this.vehicle,info1, dtest1);

hWHibernateAdapter.saveObject(vehicle1);
} catch (Exception e) {
//fail(e.getMessage());
e.printStackTrace();
System.out.println("*****Caught exception :" + e);
}
}


Top
 Profile  
 
 Post subject: configring multiple databases
PostPosted: Wed Feb 04, 2004 9:42 pm 
Beginner
Beginner

Joined: Tue Jan 27, 2004 10:59 am
Posts: 24
just as addendum to my previous post-
any special rules while trying to configure multiple databases and use them in java code using hibernate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 05, 2004 9:06 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Actually this may fail if the same objects are mapped into both DB, the unsaved-value has to be very carefully set.
Second mapping non-shared objects relationship is impossible. Hibernate doesn't abstract a multi DB datastore.
Third, you may need 2PC depending your business needs

_________________
Emmanuel


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