-->
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.  [ 1 post ] 
Author Message
 Post subject: Query Issue
PostPosted: Fri Apr 25, 2014 10:10 am 
Newbie

Joined: Fri Apr 25, 2014 10:05 am
Posts: 1
Can you find issue with the following code? [jdk1.7, MySQL 5.6, Hibernate 4.3]

getting error...

java.lang.NoClassDefFoundError: Could not initialize class gov.sec.dmzops.HibernateUtil
at org.glassfish.jersey.archetypes.AccessionNumberResource.<init>(AccessionNumberResource.java:31)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1105)
at org.jvnet.hk2.internal.ClazzCreator.createMe(ClazzCreator.java:292)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:422)
-------------------------------------------------------------------------------
List<Company> companies = new ArrayList<>();
try {
Session sess = sessionFactory.openSession();
Transaction transact = sess.beginTransaction();
/* select c.cik, c.conformed_name
from filing_values fv
join company c on (fv.cik = c.cik)
where fv.accession_number = ?
order by c.conformed_name;
Example: Use This Where Clause To Return 7 Rows: where fv.accession_number = '0001005477-09-000013'
*/ /* Query createQuery = sess.createQuery("from Filing fv " +
"join Company c on (fv.cik = c.id.cik) where fv.accessionNumber = "+ quote(num));
*/
Query createQuery = sess.createQuery("from Filer f join f.company company on " +
"(f.cik = company.cik) where f.accessionNumber = " + quote(num));
List<?> mothers = createQuery.list();
System.out.println("size:" + mothers.size());
transact.commit();
sess.close();
} catch (QueryException n) {
System.out.println("Bad database query: " + n.getMessage());
} catch (ObjectNotFoundException nf) {
System.out.println(nf.getMessage());
} catch (SQLGrammarException gram) {
System.out.println(gram.getMessage() + " home skillet!");
} catch (HibernateException e) {
System.out.println("_____");
e.printStackTrace();
}
return companies;
}


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

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.