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; }
|