-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to obtain configuration object?
PostPosted: Wed Apr 16, 2008 2:30 pm 
Beginner
Beginner

Joined: Mon Apr 07, 2008 12:49 pm
Posts: 33
JBOSS4.2 + JPA

I need to check if name query exists? i saw that configuration object has this data. i wonder i can i obtain this object in JPA?

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 18, 2008 4:39 pm 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

To get hold of the Configuration object you have to rebuild it. The underlying SessionFactory does not retain the used Configuration object (http://www.hibernate.org/118.html).

But couldn't you just do something like this:
Code:
try {
   em.getNamedQuery("myquery");
} catch (IllegalArgumentException iae ) {
  // do whatever you have to do in case the named query does not exist
}


As per spec an IllegalArgumentException is thrown if the query does not exists.


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