-->
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: No back end found?
PostPosted: Tue Mar 08, 2005 3:35 am 
Beginner
Beginner

Joined: Mon Mar 07, 2005 12:02 pm
Posts: 39
Hibernate version:2.0


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class
name="Order"
table="manylist"
dynamic-update="false"
dynamic-insert="false">
<id
name="id"
column="ID"
type="java.lang.Long"
unsaved-value="null">
<generator class="native">
</generator>
</id>
<property
name="description"
type="java.lang.String"
update="true"
insert="true"
column="description"/>
</class>

</hibernate-mapping>

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping
>
<class
name="Customer"
table="customers"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="id"
column="id"
type="long"
>
<generator class="native">
</generator>
</id>

<property
name="name"
type="java.lang.String"
update="true"
insert="true"
column="name"
/>
<set
name="orders"
lazy="false"
inverse="false"
cascade="none"
sort="unsorted">
<keycolumn="customer_id">
</key>

<one-to-many class="Order"/>
</set>
</class>

</hibernate-mapping>


Code:
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Session;
import net.sf.hibernate.SessionFactory;
import net.sf.hibernate.Transaction;
import net.sf.hibernate.cfg.Configuration;
import java.util.*;
public class GetReport {
   public GetReport(){
      
   }
public static void main(String[]args) throws Exception{
   Configuration cfg = new Configuration()
                .addClass(Customer.class)
   .addClass(Order.class);
                SessionFactory sf = cfg.buildSessionFactory();
   Session sess = sf.openSession();
   Transaction tx = null;
   try {
      tx = sess.beginTransaction();
      List ls = sess.find("from Customer");
      for (Iterator it = ls.iterator(); it.hasNext();) {
         Customer cr = (Customer) it.next();
         System.out.println( "Animal '" + cr.getName() +
         "' its class is: " + cr.getClass().getName());
         System.out.print("Makes sound: ");
         
         }
      tx.commit();
   } catch (HibernateException e) {
      if (tx!=null) tx.rollback();
      throw e;
      }
      finally {
      sess.close();
      }
}
}


Code:
(cfg.Environment                     378 ) Hibernate 2.0 final
(cfg.Environment                     407 ) hibernate.properties not found
(cfg.Environment                     427 ) using CGLIB reflection optimizer
(cfg.Environment                     437 ) JVM proxy support: true
(cfg.Configuration                   283 ) Mapping resource: Customer.hbm.xml
(mapping.Collection                  174 ) Mapping class: Customer -> customers
(cfg.Configuration                   283 ) Mapping resource: Order.hbm.xml
(mapping.Collection                  174 ) Mapping class: Order -> manylist
(mapping.Collection                  976 ) Mapping collection: Customer.orders -> manylist
java.lang.ExceptionInInitializerError
   at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:613)
   at GetReport.main(GetReport.java:27)
Caused by: java.lang.IllegalStateException: No backend found
   at net.sf.cglib.CodeGenerator.<init>(CodeGenerator.java:127)
   at net.sf.cglib.KeyFactoryGenerator.<init>(KeyFactoryGenerator.java:93)
   at net.sf.cglib.KeyFactory.create(KeyFactory.java:114)
   at net.sf.hibernate.impl.SessionFactoryImpl.<clinit>(SessionFactoryImpl.java:318)
   ... 2 more
Exception in thread "main"


MySql Server 4.1

What seems to be the problem here? Im new to hibernate so this might just be a stupid problem


Top
 Profile  
 
 Post subject: another thought
PostPosted: Tue Mar 08, 2005 9:35 am 
Beginner
Beginner

Joined: Mon Mar 07, 2005 12:02 pm
Posts: 39
I recently got this error and remembered that I got it before and just removed the access attribute in property, I though maybe this could be part of my problem, any ideas?

Code:
(cfg.Environment                     378 ) Hibernate 2.0 final
(cfg.Environment                     407 ) hibernate.properties not found
(cfg.Environment                     427 ) using CGLIB reflection optimizer
(cfg.Environment                     437 ) JVM proxy support: true
(cfg.Configuration                   283 ) Mapping resource: tutorial/basic/Pet.hbm.xml
(util.XMLHelper                      37  ) Error parsing XML: XML InputStream(32)
org.xml.sax.SAXParseException: Attribute "access" must be declared for element type "property".
   at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
   at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
   at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
   at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
   at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
   at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
   at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
   at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
   at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
   at org.dom4j.io.SAXReader.read(SAXReader.java:334)
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
   at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:286)
   at tutorial.basic.BasicDemo.<init>(BasicDemo.java:25)
   at tutorial.basic.BasicDemo.main(BasicDemo.java:15)
(util.XMLHelper                      37  ) Error parsing XML: XML InputStream(42)
org.xml.sax.SAXParseException: Attribute "access" must be declared for element type "property".
   at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
   at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
   at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
   at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
   at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
   at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
   at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
   at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
   at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
   at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
   at org.dom4j.io.SAXReader.read(SAXReader.java:334)
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
   at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:286)
   at tutorial.basic.BasicDemo.<init>(BasicDemo.java:25)
   at tutorial.basic.BasicDemo.main(BasicDemo.java:15)
(mapping.Collection                  174 ) Mapping class: tutorial.basic.Pet -> PET
java.lang.ExceptionInInitializerError
   at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:613)
   at tutorial.basic.BasicDemo.<init>(BasicDemo.java:27)
   at tutorial.basic.BasicDemo.main(BasicDemo.java:15)
Caused by: java.lang.IllegalStateException: No backend found
   at net.sf.cglib.CodeGenerator.<init>(CodeGenerator.java:127)
   at net.sf.cglib.KeyFactoryGenerator.<init>(KeyFactoryGenerator.java:93)
   at net.sf.cglib.KeyFactory.create(KeyFactory.java:114)
   at net.sf.hibernate.impl.SessionFactoryImpl.<clinit>(SessionFactoryImpl.java:318)
   ... 3 more
Exception in thread "main"


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.