Hibernate DB Configuration

Hi everyone,
I'm having a diffiuculty connecting to my database with a Hibernate application. All configuration data are listed below in hibernate.cfg.xml . I know the data are correct because they work fine in a different application. The hibernate.cfg.xml file is located in the same directory as my HibernateUtil class, which is where the SessionFactory is created. Also, the db driver is listed as a classpath pathelement in the build script. I keep getting the error listed below. Can anyone think of a way to fix it? Thanks in advance!
Itchy
Here is the error:
com/myco/myapp/hibernate/util/HibernateUtil.java [12:1] variable sessionFactory might not have been initialized
public class HibernateUtil {
Here is the HibernateUtil code that creates the session factory:
private static final SessionFactory sessionFactory;
sessionFactory = new Configuration().configure().buildSessionFactory();
Here is hibernate.cfg.xml
<!-- Generated file - Do not edit! -->
<hibernate-configuration>
     <!-- a SessionFactory instance listed as /jndi/name -->
     <session-factory>
          <!-- properties -->
          <property name="dialect">net.sf.hibernate.dialect.SAPDBDialect</property>
          <property name="show_sql">true</property>
          <property name="use_outer_join">false</property>
               <property name="connection.username">Developer</property>
               <property name="connection.password">Developer</property>
               <property name="connection.driver_class">com.sap.dbtech.jdbc.DriverSapDB</property>
               <property name="connection.url">jdbc:sapdb://DBMACHINE/MYDB</property>
          <!-- mapping files -->
          <mapping resource="com/myco/myapp/hibernate/CompanyHibernateImpl.hbm.xml"/>
     </session-factory>
</hibernate-configuration>

Hi again duffymo,
I can't write it that way because it is a class variable. Sorry, I'm not following you here. This works, and it's static:
public class StaticFinalTester
    public static final String VALUE = "Am I still null?";
    public static void main(String [] args)
        System.out.println(VALUE);
Plus, I've used the class before without
problems, so I'm convinced that the error is due to
configuration.. You have an empty catch block in there - sure that's a good idea? That's the perfect way to have a problem that you'll never find. I'd print or log the exception at a minimum.
Here is the whole HibernateUtil
class:
import net.sf.hibernate.*;
import net.sf.hibernate.cfg.Configuration;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import net.sf.hibernate.MappingException;
public class HibernateUtil {
private static final SessionFactory sessionFactory;
static {
try{
sessionFactory = new
Configuration().configure().buildSessionFactory();
}catch(HibernateException e){
public static final ThreadLocal session = new
ThreadLocal();
public static Session currentSession() throws
HibernateException {
Session s = (Session) session.get();
// Open a new Session, if this Thread has none yet
if (s == null) {
s = sessionFactory.openSession();
session.set(s);
return s;
public static void closeSession()throws
HibernateException {
Session s = (Session) session.get();
session.set(null);
if (s != null)
s.close();

Similar Messages

  • Web Service java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration

    I have built a EAR file (using ANT build.xml from eclipse) and deploy it to WebLogic server, when I test the web service with a Test Client, I will receive the exception:
    java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
    Anything wrong with my build.xml file below? Why I get this exception?
    <?xml version="1.0" encoding="UTF-8"?>
    <project name="MyWebServices" default="all">  
         <!-- set global properties for this build -->   
         <property name="wls.username" value="weblogic" />   
         <property name="wls.password" value="abcd1234" />   
         <property name="wls.hostname" value="localhost" />   
         <property name="wls.port" value="7001" />   
         <property name="wls.server.name" value="AdminServer" />   
         <property name="ear.deployed.name" value="MyWebServicesEar" />
         <property name="example-output" value="output" />   
         <property name="ear-dir" value="${example-output}/MyWebServicesEar" />   
         <property name="clientclass-dir" value="${example-output}/clientclasses" />   
         <path id="client.class.path">       
              <pathelement path="${clientclass-dir}" />       
              <pathelement path="${java.class.path}" />   
         </path>
         <taskdef name="jwsc" classname="weblogic.wsee.tools.anttasks.JwscTask" />   
         <taskdef name="clientgen" classname="weblogic.wsee.tools.anttasks.ClientGenTask" />   
         <taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy" />
         <target name="build-service">       
              <jwsc srcdir="src" destdir="${ear-dir}">
                   <classpath>      
                        <pathelement path="${java.class.path}" />
                        <pathelement path="WebContent/WEB-INF/lib"/>
                   </classpath>
                   <module contextPath="MyWebServices" name="MyWebServicesModule">
                        <jws file="/hk/com/my/webservices/servicefacade/CustomerWS.java" type="JAXWS" />                 
                        <jws file="/hk/com/my/webservices/servicefacade/LoginWS.java" type="JAXWS" />               
                        <jws file="/hk/com/my/webservices/servicefacade/PaymentWS.java" type="JAXWS" />
                        <!-- <jws file="/hk/com/my/webservices/servicefacade/RedemptionWS.java" type="JAXWS" /> -->
                   </module>
              </jwsc>
         </target>   
         <target name="deploy">
              <wldeploy action="deploy" name="${ear.deployed.name}" source="${ear-dir}" user="${wls.username}" password="${wls.password}" verbose="true" adminurl="t3://${wls.hostname}:${wls.port}" targets="${wls.server.name}" />   
         </target>   
         <target name="undeploy">       
              <wldeploy action="undeploy" name="${ear.deployed.name}" failonerror="false" user="${wls.username}" password="${wls.password}" verbose="true" adminurl="t3://${wls.hostname}:${wls.port}" targets="${wls.server.name}" />   
         </target>         
         <target name="all" depends="clean,build-service,deploy" />
         <target name="clean" depends="undeploy">       
              <delete dir="${example-output}" />   
         </target> 
         <target name="run">       
              <java classname="hk.com.my.webservices.servicefacade.client.Main" fork="true" failonerror="true">
                   <classpath refid="client.class.path" />                           
                   <arg line="http://${wls.hostname}:${wls.port}/MyServices" />
              </java>   
         </target>
    </project>

    The problem was because I did not include my web-inf into the ear in my build.xml, i added it using the zipfileset tag and it worked like a charm:
    <target name="build-service">          
              <jwsc srcdir="src" destdir="${ear-dir}" debug="on">
                   <!-- "contextPath" is like a folder to contain the Web Services, "name" is the name of the WAR file -->
                   <module contextPath="MyWebServices" name="MyWebServicesModule">
                        <jws file="/my/webservices/servicefacade/CustomerWS.java" type="JAXWS" />          
                        <jws file="/my/webservices/servicefacade/LoginWS.java" type="JAXWS" />                                                                 
                        <!-- include and copy the required files to the ear directory -->
                        <zipfileset dir="WebContent/WEB-INF/lib" prefix="WEB-INF/lib">
                             <include name="*.jar"/>
                        </zipfileset>                              
                   </module>
              </jwsc>
    </target>

  • ADF Libs with Eclipse Hibernate/Spring Configuration

    Hi
    I have been using Spring and Hibernate in our projects.
    Now we plan to use ADF in the same project.
    I would like to know whether the JDeveloper 11g R2 with ADF Libs conflict with Eclipse Spring/Hibernate Configuration.
    Thanks in advance..
    Regards,
    Bala

    here is one how to use spring, and for Hibernate, since JPA support is there shouldn't be a problem
    http://technology.amis.nl/blog/765/spring-and-oracle-adf-registering-a-pojo-spring-jdbc-based-business-service-as-data-control.
    As far as eclipse is concerned, oracle has its only flavor of eclipse but i doubt it has the full features of ADF
    http://www.oracle.com/technetwork/developer-tools/eclipse/downloads/index.html
    Edited by: in the line of fire on Jul 26, 2011 12:11 PM

  • JSF Hibernate websphere configuration

    I am new to JSF and implementing this in my new project. I am using MyEclipse6.0.1 as the IDE and adding JSF capabilities in the project with the wizard. I am using hibernate 3.1 and websphere6.1.
    I am testing configuration with a very small application. My application is not working. I treid to add all the jar files, but still it is not showing anything, I am using maven2 to build the project. In the console window of myeclipse I am getting Faces Servlet is unavailable.
    Please let me know all the versions that I have mentioned are working together or I need to add some other version jar files.
    I am really struggling lot with JSF. Please help me solve this problem.

    I am new to JSF and implementing this in my new project. I am using MyEclipse6.0.1 as the IDE and adding JSF capabilities in the project with the wizard. I am using hibernate 3.1 and websphere6.1.
    I am testing configuration with a very small application. My application is not working. I treid to add all the jar files, but still it is not showing anything, I am using maven2 to build the project. In the console window of myeclipse I am getting Faces Servlet is unavailable.
    Please let me know all the versions that I have mentioned are working together or I need to add some other version jar files.
    I am really struggling lot with JSF. Please help me solve this problem.

  • Problem parsing configuration/hibernate.cfg.xml

    I am trying to integrate struts with hibernate. I have created a plug-in for that and copied all the necessary jars & xmls to the classpath. I am providing the full stack trace, can any one say what could be the problem
    net.sf.hibernate.HibernateException: problem parsing configuration/hibernate.cfg
    .xml
    at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:963
    at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:902)
    at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:888)
    at com.plugin.HibernatePlugIn.initHibernate(HibernatePlugIn.java:72)
    at com.plugin.HibernatePlugIn.init(HibernatePlugIn.java:54)
    at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServle
    t.java:869)
    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)
    at javax.servlet.GenericServlet.init(GenericServlet.java:211)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
    java:1029)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:86
    2)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
    t.java:4013)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
    357)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
    .java:823)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:80
    7)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
    at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDep
    loyer.java:277)
    at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
    at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:625
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:431
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
    :349)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
    eSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478
    at org.apache.catalina.core.StandardService.start(StandardService.java:4
    80)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:231
    3)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
    Caused by: org.dom4j.DocumentException: hibernate.sourceforge.net Nested excepti
    on: hibernate.sourceforge.net
    at org.dom4j.io.SAXReader.read(SAXReader.java:358)
    at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:958
    )

    Looks like a problem with Hibernate itself parsing the config file?
    Here's a posting from the Hibernate forum that sounds similar:
    http://forums.hibernate.org/viewtopic.php?p=2256871&highlight=&sid=e1090f717891db4535310102c61bec25
    -steve-

  • How to configure Sesion Factory in Hibernate to implement getCurrentSession

    Hi,
    I am new in Hibernate and I am using an application where I need to improve the performance while uploading the users through a utility. While analyzing the system, I found that, to insert a single user there were around 8 hits are made to DB to get the information and based on that finally it inserts the user. The strange thing I have noticed is that for every hit, a new DB connection is opened in code using the snippet getHibernateTemplate().getSessionFactory().openSession();
    However, the connection is getting closed in finally block. But I think instead of using Open Connection; getCurrentSession can save time.
    Can any one suggest whether I am on right track?
    Also, when I have tried to use getCurrentSession I have simply replaced "getHibernateTemplate().getSessionFactory().openSession();" with "getHibernateTemplate().getSessionFactory().getCurrentSession();" from everywhere in code.
    But when I tried to run the Utility I got some Hibernate Exception stating "No Hibernate Session bound to thread, and configuration does not allow creation".
    Could anyone suggest do I need to configure anything else in my applicationcontext.xml to use the getCurrentSession() method.
    Thanks in advance.

    the method getCurrentSession() should be done using Singleton factory method so that you have only one connection per application. You can implement something like this as coded below:
    import java.io.File;
    import javax.naming.InitialContext;
    import org.apache.log4j.Logger;
    import org.hibernate.HibernateException;
    import org.hibernate.Session;
    import org.hibernate.SessionFactory;
    import org.hibernate.cfg.Configuration;
    import org.hibernate.cfg.Environment;
    * @author hennebrueder This class garanties that only one single SessionFactory
    *         is instanciated and that the configuration is done thread safe as
    *         singleton. Actually it only wraps the Hibernate SessionFactory.
    *         When a JNDI name is configured the session is bound to to JNDI,
    *         else it is only saved locally.
    *         You are free to use any kind of JTA or Thread transactionFactories.
    public class InitSessionFactory {
          * Default constructor.
         private InitSessionFactory() {
          * Location of hibernate.cfg.xml file. NOTICE: Location should be on the
          * classpath as Hibernate uses #resourceAsStream style lookup for its
          * configuration file. That is place the config file in a Java package - the
          * default location is the default Java package.<br>
          * <br>
          * Examples: <br>
          * <code>CONFIG_FILE_LOCATION = "/hibernate.conf.xml".
          * CONFIG_FILE_LOCATION = "/com/foo/bar/myhiberstuff.conf.xml".</code>
         private static String CONFIG_FILE_LOCATION = "<Path to hibernate.cfg.xml>";
         /** The single instance of hibernate configuration */
         private static final Configuration cfg = new Configuration();
         /** The single instance of hibernate SessionFactory */
         private static org.hibernate.SessionFactory sessionFactory;
          * initialises the configuration if not yet done and returns the current
          * instance
          * @return
         public static SessionFactory getInstance() {
              if (sessionFactory == null)
                   initSessionFactory();
              return sessionFactory;
          * Returns the ThreadLocal Session instance. Lazy initialize the
          * <code>SessionFactory</code> if needed.
          * @return Session
          * @throws HibernateException
         public Session openSession() {
              return sessionFactory.getCurrentSession();
          * The behaviour of this method depends on the session context you have
          * configured. This factory is intended to be used with a hibernate.cfg.xml
          * including the following property <property
          * name="current_session_context_class">thread</property> This would return
          * the current open session or if this does not exist, will create a new
          * session
          * @return
         public Session getCurrentSession() {
              return sessionFactory.getCurrentSession();
          * initializes the sessionfactory in a safe way even if more than one thread
          * tries to build a sessionFactory
         private static synchronized void initSessionFactory() {
               * [laliluna] check again for null because sessionFactory may have been
               * initialized between the last check and now
              Logger log = Logger.getLogger(InitSessionFactory.class);
              if (sessionFactory == null) {
                   try {
                        File f = new File(CONFIG_FILE_LOCATION);
                        cfg.configure(f);
                        String sessionFactoryJndiName = cfg
                        .getProperty(Environment.SESSION_FACTORY_NAME);
                        if (sessionFactoryJndiName != null) {
                             cfg.buildSessionFactory();
                             log.debug("get a jndi session factory");
                             sessionFactory = (SessionFactory) (new InitialContext())
                                       .lookup(sessionFactoryJndiName);
                             //sessionFactory = new AnnotationConfiguration().configure(System.getProperty("user.dir") + "\\" + CONFIG_FILE_LOCATION).buildSessionFactory();
                        } else{
                             log.debug("classic factory");
                             sessionFactory = cfg.buildSessionFactory();
                   } catch (Exception e) {
                        System.err
                                  .println("%%%% Error Creating HibernateSessionFactory %%%%");
                        e.printStackTrace();
                        throw new HibernateException(
                                  "Could not initialize the Hibernate configuration");
         public static void close(){
              if (sessionFactory != null)
                   sessionFactory.close();
              sessionFactory = null;
    }Test it and let me know.

  • Org.hibernate.MappingException: invalid configuration  in hibernate

    hi,
    i am new to hibernate.
    while i am executing small program, below error occur.
    what can i do to solve this problem, plz help me.
    Error Code
    log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
    log4j:WARN Please initialize the log4j system properly.
    Exception occur:invalid configuration
    org.hibernate.MappingException: invalid configuration+
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1493)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1434)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1420)
    at FirstExample.main(FirstExample.java:12)
    Caused by: org.xml.sax.SAXParseException: Document is invalid: no grammar found.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.dom4j.io.SAXReader.read(SAXReader.java:465)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1490)
    ... 3 more
    Exception in thread "main" java.lang.NullPointerException
    at FirstExample.main(FirstExample.java:26)

    Thank u .
    I did all configuration properly by some guideline.
    But i got new error in my program.
    please reply me.
    This is my program
    *{color:#3366ff}Test.java{color}*
    import org.hibernate.HibernateException;
    import org.hibernate.Session;
    import org.hibernate.SessionFactory;
    import org.hibernate.cfg.Configuration;
    import event.Sample;
    public class Test {
    public static void main(String a[])throws HibernateException
    Session session=null;
    try
    SessionFactory sessionFactory=new Configuration().configure().buildSessionFactory();
    session=sessionFactory.openSession();
    System.out.println("Insert record ");
    Sample s=new Sample();
    s.setId(3);
    s.setName("Sundar");
    session.save(s);
    System.out.println("Sucessfully Saved");
    }catch(Exception e)
    System.out.println("Exception occur:"+e.getMessage());
    e.printStackTrace();
    }finally
    session.flush();
    session.close();
    *{color:#3366ff}Java Bean Sample.java{color}*
    package event;
    public class Sample {
    private int id;
    private String name;
    public int getId() {
    return id;
    public void setId(int id) {
    this.id = id;
    public String getName() {
    return name;
    public void setName(String name) {
    this.name = name;
    *{color:#3366ff}{color:#ff0000}hibernate.cfg.xml file{color}*
    *<?xml version="1.0" encoding="utf-8"?>*
    *<!DOCTYPE hibernate-configuration PUBLIC*
    *"-//Hibernate/Hibernate Configuration DTD 3.0//EN"*
    *"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">*
    *<hibernate-configuration>*
    * <session-factory>*
    * <!-- local connection properties -->*
    * <property name="hibernate.connection.url">*
    * jdbc:mysql://localhost:3306/test*
    * </property>*
    * <property name="hibernate.connection.driver_class">*
    * com.mysql.jdbc.Driver*
    * </property>*
    * <property name="hibernate.connection.username">root</property>*
    * <property name="hibernate.connection.password">server</property>*
    * <!-- property name="hibernate.connection.pool_size"></property -->*
    * <!-- dialect for MySQL -->*
    * <property name="dialect">*
    * org.hibernate.dialect.MySQLDialect*
    * </property>*
    * <property name="hibernate.show_sql">false</property>*
    * <property name="hibernate.transaction.factory_class">*
    * org.hibernate.transaction.JDBCTransactionFactory*
    * </property>*
    * <mapping resource="event/Sample.hbm.xml" />*
    * </session-factory>*
    *</hibernate-configuration>*
    *{color:#ff0000}{color:#000000}Sample.hbm.xml file{color}*
    *<?xml version="1.0" encoding="utf-8"?>*
    *<!DOCTYPE hibernate-mapping PUBLIC*
    * "-//Hibernate/Hibernate Mapping DTD//EN"*
    * "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >*
    *<hibernate-mapping package="event">*
    * <class name="Sample" table="sample" >*
    * <meta attribute="sync-DAO">true</meta>*
    * <property name="Id" column="id" type="integer" not-null="false" length="11" />*
    * <property name="Name" column="name" type="string" not-null="false" length="50" />*
    * </class>*
    *</hibernate-mapping>*
    *{color}{color}*
    *{color:#3366ff}
    This is my error.{color}*
    log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
    log4j:WARN Please initialize the log4j system properly.
    Exception occur:Could not parse mapping document from resource event/Sample.hbm.xml
    org.hibernate.InvalidMappingException: Could not parse mapping document from resource event/Sample.hbm.xml
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:575)
    at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1593)
    at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1561)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1540)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1514)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1434)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1420)
    at Test.main(Test.java:15)
    Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from invalid mapping
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:508)
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:572)
    ... 7 more
    Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(query|sql-query)*)".
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.dom4j.io.SAXReader.read(SAXReader.java:465)
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:505)
    ... 8 more
    Exception in thread "main" java.lang.NullPointerException
    at Test.main(Test.java:29)

  • Hibernate 3.0 Configuration Problem

    Dear friends,
    I tried to test Hibernate 3.0 via a simple example. But I met strange problems.
    In my Main.java, I put
              Configuration cfg = new Configuration();
              cfg.addClass(hb.Keyword.class);
              cfg.addClass(hb.KeySet.class);
              cfg.configure("/hibernate.cfg.xml");
              SessionFactory sessions = cfg.buildSessionFactory();
              Session session = sessions.openSession();
    Then whatever the content of "hibernate.cfg.xml", there is no parsing error. In log file, it is always,
    09:18:56,328 ERROR SchemaUpdate:129 - could not get database metadata
    It seems the configuration file is nerver really parsed.
    What king of missing details could cause this?
    Thanks.
    Pengyou
    PS:
    09:35:31,859 ERROR SchemaUpdate:129 - could not get database metadata
    java.sql.SQLException: Table not found in statement [select sequence_name from system_sequences]
         at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
         at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
         at org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source)
         at org.hibernate.tool.hbm2ddl.DatabaseMetadata.initSequences(DatabaseMetadata.java:113)
         at org.hibernate.tool.hbm2ddl.DatabaseMetadata.<init>(DatabaseMetadata.java:39)
         at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:124)
         at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:265)
         at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005)
         at Main.main(Main.java:29)
    09:35:31,859 ERROR SchemaUpdate:158 - could not complete schema update
    java.sql.SQLException: Table not found in statement [select sequence_name from system_sequences]
         at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
         at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
         at org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source)
         at org.hibernate.tool.hbm2ddl.DatabaseMetadata.initSequences(DatabaseMetadata.java:113)
         at org.hibernate.tool.hbm2ddl.DatabaseMetadata.<init>(DatabaseMetadata.java:39)
         at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:124)
         at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:265)
         at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005)
         at Main.main(Main.java:29)
    hibernate.cfg.xml contents:
    <?xml version='1.0' encoding='utf-8'?>
    <!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
    <hibernate-configuration>
    <session-factory>
    <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
    <property name="hibernate.connection.url">jdbc:hsqldb:db/test</property>
    <property name="hibernate.connection.username">sa</property>
    <property name="hibernate.connection.password"></property>
    <property name="dialect">org.hibernate.dialect.HSQLDialect</property>
    <property name="show_sql">true</property>
    <property name="transaction.factory_class">
    org.hibernate.transaction.JDBCTransactionFactory
    </property>
    <property name="hibernate.cache.provider_class">
    org.hibernate.cache.HashtableCacheProvider
    </property>
    <property name="hibernate.hbm2ddl.auto">update</property>
    <mapping resource="hb/KeySet.hbm.xml"/>
    <mapping resource="hb/Keyword.hbm.xml"/>
    </session-factory>
    </hibernate-configuration>

    Thanks.
    But then it gave the following exception:
    11:05:08,390 WARN SettingsFactory:103 - Could not obtain connection metadata
    java.sql.SQLException: File input/output error: java.io.IOException: The filename, directory name, or volume label syntax is incorrect
         at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
         at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source)
         at org.hsqldb.jdbcDriver.getConnection(Unknown Source)
         at org.hsqldb.jdbcDriver.connect(Unknown Source)
         at java.sql.DriverManager.getConnection(DriverManager.java:525)
         at java.sql.DriverManager.getConnection(DriverManager.java:140)
         at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
         at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:72)
         at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
         at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)
         at Main.main(Main.java:29)
    11:05:08,609 WARN Configurator:126 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/C:/Java/hibernate-3.0/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
    11:05:09,015 WARN JDBCExceptionReporter:71 - SQL Error: -29, SQLState: S1000
    11:05:09,015 ERROR JDBCExceptionReporter:72 - File input/output error: java.io.IOException: The filename, directory name, or volume label syntax is incorrect

  • Org.hibernate.PropertyNotFoundException: Could not find a getter for id in

    [skumar@aithdell3 events]$ java EventManager
    May 15, 2008 8:39:41 PM org.hibernate.cfg.Environment <clinit>
    INFO: Hibernate 3.2.3
    May 15, 2008 8:39:41 PM org.hibernate.cfg.Environment <clinit>
    INFO: hibernate.properties not found
    May 15, 2008 8:39:41 PM org.hibernate.cfg.Environment buildBytecodeProvider
    INFO: Bytecode provider name : cglib
    May 15, 2008 8:39:41 PM org.hibernate.cfg.Environment <clinit>
    INFO: using JDK 1.4 java.sql.Timestamp handling
    May 15, 2008 8:39:42 PM org.hibernate.cfg.Configuration configure
    INFO: configuring from resource: /hibernate.cfg.xml
    May 15, 2008 8:39:42 PM org.hibernate.cfg.Configuration getConfigurationInputStream
    INFO: Configuration resource: /hibernate.cfg.xml
    May 15, 2008 8:39:42 PM org.hibernate.cfg.Configuration addResource
    INFO: Reading mappings from resource : Event.hbm.xml
    May 15, 2008 8:39:43 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
    INFO: Mapping class: Event -> EVENTS
    May 15, 2008 8:39:43 PM org.hibernate.cfg.Configuration doConfigure
    INFO: Configured SessionFactory: null
    May 15, 2008 8:39:43 PM org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: Using Hibernate built-in connection pool (not for production use!)
    May 15, 2008 8:39:43 PM org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: Hibernate connection pool size: 1
    May 15, 2008 8:39:43 PM org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: autocommit mode: false
    May 15, 2008 8:39:43 PM org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:sql://localhost
    May 15, 2008 8:39:43 PM org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: connection properties: {user=sa, password=****}
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: RDBMS: HSQL Database Engine, version: 1.8.0
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC driver: HSQL Database Engine Driver, version: 1.8.0
    May 15, 2008 8:39:44 PM org.hibernate.dialect.Dialect <init>
    INFO: Using dialect: org.hibernate.dialect.HSQLDialect
    May 15, 2008 8:39:44 PM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
    INFO: Using default transaction strategy (direct JDBC transactions)
    May 15, 2008 8:39:44 PM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
    INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Automatic flush during beforeCompletion(): disabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Automatic session close at end of transaction: disabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC batch size: 15
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC batch updates for versioned data: disabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Scrollable result sets: enabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC3 getGeneratedKeys(): disabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Connection release mode: auto
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Default batch fetch size: 1
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Generate SQL with comments: disabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Order SQL updates by primary key: disabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
    INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
    May 15, 2008 8:39:44 PM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
    INFO: Using ASTQueryTranslatorFactory
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Query language substitutions: {}
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JPA-QL strict compliance: disabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Second-level cache: enabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Query cache: disabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory createCacheProvider
    INFO: Cache provider: org.hibernate.cache.NoCacheProvider
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Optimize cache for minimal puts: disabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Structured second-level cache entries: disabled
    May 15, 2008 8:39:45 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Echoing all SQL to stdout
    May 15, 2008 8:39:45 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Statistics: disabled
    May 15, 2008 8:39:45 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Deleted entity synthetic identifier rollback: disabled
    May 15, 2008 8:39:45 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Default entity-mode: pojo
    May 15, 2008 8:39:45 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Named query checking : enabled
    May 15, 2008 8:39:45 PM org.hibernate.impl.SessionFactoryImpl <init>
    INFO: building session factory
    Intial session factory creation failed org.hibernate.PropertyNotFoundException: Could not find a getter for id in class Event
    Exception in thread "main" java.lang.ExceptionInInitializerError
    at HibernateUtil.<clinit>(HibernateUtil.java:18)
    at EventManager.main(EventManager.java:11)
    Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for id in class Event
    at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:282)
    at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:275)
    at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:168)
    at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:44)
    at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:123)
    at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
    at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
    at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
    at HibernateUtil.<clinit>(HibernateUtil.java:14)
    How can i fix this exception
    Please help me.
    Thanks in advance

    [skumar@aithdell3 events]$ java EventManager
    May 15, 2008 8:39:41 PM org.hibernate.cfg.Environment <clinit>
    INFO: Hibernate 3.2.3
    May 15, 2008 8:39:41 PM org.hibernate.cfg.Environment <clinit>
    INFO: hibernate.properties not found
    May 15, 2008 8:39:41 PM org.hibernate.cfg.Environment buildBytecodeProvider
    INFO: Bytecode provider name : cglib
    May 15, 2008 8:39:41 PM org.hibernate.cfg.Environment <clinit>
    INFO: using JDK 1.4 java.sql.Timestamp handling
    May 15, 2008 8:39:42 PM org.hibernate.cfg.Configuration configure
    INFO: configuring from resource: /hibernate.cfg.xml
    May 15, 2008 8:39:42 PM org.hibernate.cfg.Configuration getConfigurationInputStream
    INFO: Configuration resource: /hibernate.cfg.xml
    May 15, 2008 8:39:42 PM org.hibernate.cfg.Configuration addResource
    INFO: Reading mappings from resource : Event.hbm.xml
    May 15, 2008 8:39:43 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
    INFO: Mapping class: Event -> EVENTS
    May 15, 2008 8:39:43 PM org.hibernate.cfg.Configuration doConfigure
    INFO: Configured SessionFactory: null
    May 15, 2008 8:39:43 PM org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: Using Hibernate built-in connection pool (not for production use!)
    May 15, 2008 8:39:43 PM org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: Hibernate connection pool size: 1
    May 15, 2008 8:39:43 PM org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: autocommit mode: false
    May 15, 2008 8:39:43 PM org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:sql://localhost
    May 15, 2008 8:39:43 PM org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: connection properties: {user=sa, password=****}
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: RDBMS: HSQL Database Engine, version: 1.8.0
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC driver: HSQL Database Engine Driver, version: 1.8.0
    May 15, 2008 8:39:44 PM org.hibernate.dialect.Dialect <init>
    INFO: Using dialect: org.hibernate.dialect.HSQLDialect
    May 15, 2008 8:39:44 PM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
    INFO: Using default transaction strategy (direct JDBC transactions)
    May 15, 2008 8:39:44 PM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
    INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Automatic flush during beforeCompletion(): disabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Automatic session close at end of transaction: disabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC batch size: 15
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC batch updates for versioned data: disabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Scrollable result sets: enabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC3 getGeneratedKeys(): disabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Connection release mode: auto
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Default batch fetch size: 1
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Generate SQL with comments: disabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Order SQL updates by primary key: disabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
    INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
    May 15, 2008 8:39:44 PM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
    INFO: Using ASTQueryTranslatorFactory
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Query language substitutions: {}
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JPA-QL strict compliance: disabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Second-level cache: enabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Query cache: disabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory createCacheProvider
    INFO: Cache provider: org.hibernate.cache.NoCacheProvider
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Optimize cache for minimal puts: disabled
    May 15, 2008 8:39:44 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Structured second-level cache entries: disabled
    May 15, 2008 8:39:45 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Echoing all SQL to stdout
    May 15, 2008 8:39:45 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Statistics: disabled
    May 15, 2008 8:39:45 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Deleted entity synthetic identifier rollback: disabled
    May 15, 2008 8:39:45 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Default entity-mode: pojo
    May 15, 2008 8:39:45 PM org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Named query checking : enabled
    May 15, 2008 8:39:45 PM org.hibernate.impl.SessionFactoryImpl <init>
    INFO: building session factory
    Intial session factory creation failed org.hibernate.PropertyNotFoundException: Could not find a getter for id in class Event
    Exception in thread "main" java.lang.ExceptionInInitializerError
    at HibernateUtil.<clinit>(HibernateUtil.java:18)
    at EventManager.main(EventManager.java:11)
    Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for id in class Event
    at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:282)
    at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:275)
    at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:168)
    at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:44)
    at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:123)
    at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
    at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
    at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
    at HibernateUtil.<clinit>(HibernateUtil.java:14)
    How can i fix this exception
    Please help me.
    Thanks in advance

  • Unable to read one-to-many relations using Hibernate

    Hi,
    I am trying with a very simple one-to-many relationship. When I am storing the objects, there are no problems. But when I am trying to read out the collection, it says invalid descriptor index. Please help.
    Regards,
    Hibernate version:
    hibernate-3.1rc2
    Mapping documents:
    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <hibernate-mapping>
         <class name="Parent">
              <id name="id">
                   <generator class="identity"/>
              </id>
              <set name="children">
                   <key column="parent_id"/>
                   <one-to-many class="Child"/>
              </set>
         </class>
         <class name="Child">
              <id name="id">
                   <generator class="identity"/>
              </id>
              <property name="name"/>
         </class>
    </hibernate-mapping>
    Code between sessionFactory.openSession() and session.close():
    The Parent class:
    public class Parent
         private Long id ;     
         private Set children;
         Parent(){}
         public Long getId()
              return id;
         public void setId(Long id)
              this.id=id;
         public Set getChildren()
              return children;
         public void setChildren(Set children)
              this.children=children;
    The Child class:
    public class Child
         private Long id;
         private String name;
         Child(){}
         public Long getId()
              return id;
         private void setId(Long id)
              this.id=id;
         public String getName()
              return name;
         public void setName(String name)
              this.name=name;
    The Main class:
    public class PCManager
         public static void main(String[] args)
              PCManager mgr = new PCManager();
              List lt = null;
              if (args[0].equals("store"))
                   mgr.createAndStoreParent(new HashSet(3));
              else if (args[0].equals("list"))
                   mgr.listEvents();
              HibernateUtil.getSessionFactory().close();
         private void createAndStoreParent(HashSet s)
              HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();
              Parent p1 = new Parent();
              int size = 3;
              for (int i=size; i>0; i--)
                   Child c = new Child();
                   c.setName("Child"+i);
                   s.add(c);
              p1.setChildren (s);
              Iterator elems = s.iterator();
              do {     
                   Child ch = (Child) elems.next();
                   HibernateUtil.getSessionFactory().getCurrentSession().save(ch);
              }while(elems.hasNext());
              HibernateUtil.getSessionFactory().getCurrentSession().save(p1);
              HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().commit();
         private void listEvents()
              HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();
              Parent result = (Parent) HibernateUtil.getSessionFactory().getCurrentSession().load(Parent.class, new Long(1));
              System.out.println("Id is :"+ result.getId());
              Set children = result.getChildren();
              Iterator elems = children.iterator();
              do {     
                   Child ch = (Child) elems.next();
                   System.out.println("Child Name"+ ch.getName());
              }while(elems.hasNext());
              HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().commit();          
    Full stack trace of any exception that occurs:
    When I run with "hbm2ddl.auto" property as validate and trying to list the contents, I get the following out put.
    C:\Documents and Settings\mirza\Desktop\hibernate-3.1rc2\MyHibernate>ant run -Da
    ction=list
    Buildfile: build.xml
    clean:
    [delete] Deleting directory C:\Documents and Settings\mirza\Desktop\hibernate
    -3.1rc2\MyHibernate\bin
    [mkdir] Created dir: C:\Documents and Settings\mirza\Desktop\hibernate-3.1rc
    2\MyHibernate\bin
    copy-resources:
    [copy] Copying 4 files to C:\Documents and Settings\mirza\Desktop\hibernate
    -3.1rc2\MyHibernate\bin
    compile:
    [javac] Compiling 5 source files to C:\Documents and Settings\mirza\Desktop\
    hibernate-3.1rc2\MyHibernate\bin
    run:
    [java] 09:09:23,433 INFO Environment:474 - Hibernate 3.1 rc2
    [java] 09:09:23,449 INFO Environment:489 - loaded properties from resource
    hibernate.properties: {hibernate.cglib.use_reflection_optimizer=true, hibernate
    .cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.dial
    ect=org.hibernate.dialect.SQLServerDialect, hibernate.max_fetch_depth=1, hiberna
    te.jdbc.use_streams_for_binary=true, hibernate.format_sql=true, hibernate.query.
    substitutions=yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.cac
    he.region_prefix=hibernate.test, hibernate.jdbc.batch_versioned_data=true, hiber
    nate.connection.pool_size=1}
    [java] 09:09:23,465 INFO Environment:519 - using java.io streams to persis
    t binary types
    [java] 09:09:23,465 INFO Environment:520 - using CGLIB reflection optimize
    r
    [java] 09:09:23,481 INFO Environment:550 - using JDK 1.4 java.sql.Timestam
    p handling
    [java] 09:09:23,559 INFO Configuration:1257 - configuring from resource: /
    hibernate.cfg.xml
    [java] 09:09:23,559 INFO Configuration:1234 - Configuration resource: /hib
    ernate.cfg.xml
    [java] 09:09:23,872 INFO Configuration:460 - Reading mappings from resourc
    e: PCMapping.hbm.xml
    [java] 09:09:24,013 INFO HbmBinder:266 - Mapping class: Parent -> Parent
    [java] 09:09:24,045 INFO HbmBinder:266 - Mapping class: Child -> Child
    [java] 09:09:24,045 INFO Configuration:1368 - Configured SessionFactory: n
    ull
    [java] 09:09:24,061 INFO Configuration:1014 - processing extends queue
    [java] 09:09:24,061 INFO Configuration:1018 - processing collection mappin
    gs
    [java] 09:09:24,061 INFO HbmBinder:2233 - Mapping collection: Parent.child
    ren -> Child
    [java] 09:09:24,076 INFO Configuration:1027 - processing association prope
    rty references
    [java] 09:09:24,076 INFO Configuration:1049 - processing foreign key const
    raints
    [java] 09:09:24,155 INFO DriverManagerConnectionProvider:41 - Using Hibern
    ate built-in connection pool (not for production use!)
    [java] 09:09:24,170 INFO DriverManagerConnectionProvider:42 - Hibernate co
    nnection pool size: 1
    [java] 09:09:24,170 INFO DriverManagerConnectionProvider:45 - autocommit m
    ode: false
    [java] 09:09:24,170 INFO DriverManagerConnectionProvider:80 - using driver
    : sun.jdbc.odbc.JdbcOdbcDriver at URL: jdbc:odbc:MySQL
    [java] 09:09:24,170 INFO DriverManagerConnectionProvider:86 - connection p
    roperties: {}
    [java] 09:09:24,264 INFO SettingsFactory:77 - RDBMS: Microsoft SQL Server,
    version: 08.00.0194
    [java] 09:09:24,264 INFO SettingsFactory:78 - JDBC driver: JDBC-ODBC Bridg
    e (SQLSRV32.DLL), version: 2.0001 (03.85.1117)
    [java] 09:09:24,296 INFO Dialect:100 - Using dialect: org.hibernate.dialec
    t.SQLServerDialect
    [java] 09:09:24,311 INFO TransactionFactoryFactory:31 - Using default tran
    saction strategy (direct JDBC transactions)
    [java] 09:09:24,327 INFO TransactionManagerLookupFactory:33 - No Transacti
    onManagerLookup configured (in JTA environment, use of read-write or transaction
    al second-level cache is not recommended)
    [java] 09:09:24,327 INFO SettingsFactory:125 - Automatic flush during befo
    reCompletion(): disabled
    [java] 09:09:24,327 INFO SettingsFactory:129 - Automatic session close at
    end of transaction: disabled
    [java] 09:09:24,343 INFO SettingsFactory:144 - Scrollable result sets: ena
    bled
    [java] 09:09:24,343 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): d
    isabled
    [java] 09:09:24,343 INFO SettingsFactory:160 - Connection release mode: au
    to
    [java] 09:09:24,358 INFO SettingsFactory:184 - Maximum outer join fetch de
    pth: 1
    [java] 09:09:24,358 INFO SettingsFactory:187 - Default batch fetch size: 1
    [java] 09:09:24,358 INFO SettingsFactory:191 - Generate SQL with comments:
    disabled
    [java] 09:09:24,358 INFO SettingsFactory:195 - Order SQL updates by primar
    y key: disabled
    [java] 09:09:24,358 INFO SettingsFactory:338 - Query translator: org.hiber
    nate.hql.ast.ASTQueryTranslatorFactory
    [java] 09:09:24,374 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTran
    slatorFactory
    [java] 09:09:24,374 INFO SettingsFactory:203 - Query language substitution
    s: {no='N', yes='Y'}
    [java] 09:09:24,374 INFO SettingsFactory:209 - Second-level cache: enabled
    [java] 09:09:24,374 INFO SettingsFactory:213 - Query cache: disabled
    [java] 09:09:24,374 INFO SettingsFactory:325 - Cache provider: org.hiberna
    te.cache.HashtableCacheProvider
    [java] 09:09:24,374 INFO SettingsFactory:228 - Optimize cache for minimal
    puts: disabled
    [java] 09:09:24,374 INFO SettingsFactory:233 - Cache region prefix: hibern
    ate.test
    [java] 09:09:24,405 INFO SettingsFactory:237 - Structured second-level cac
    he entries: disabled
    [java] 09:09:24,437 INFO SettingsFactory:257 - Echoing all SQL to stdout
    [java] 09:09:24,452 INFO SettingsFactory:264 - Statistics: disabled
    [java] 09:09:24,452 INFO SettingsFactory:268 - Deleted entity synthetic id
    entifier rollback: disabled
    [java] 09:09:24,452 INFO SettingsFactory:283 - Default entity-mode: POJO
    [java] 09:09:24,593 INFO SessionFactoryImpl:155 - building session factory
    [java] 09:09:24,938 INFO SessionFactoryObjectFactory:82 - Not binding fact
    ory to JNDI, no JNDI name configured
    [java] 09:09:24,954 INFO SchemaValidator:99 - Running schema validator
    [java] 09:09:24,954 INFO SchemaValidator:107 - fetching database metadata
    [java] 09:09:24,954 INFO Configuration:1014 - processing extends queue
    [java] 09:09:24,954 INFO Configuration:1018 - processing collection mappin
    gs
    [java] 09:09:24,954 INFO Configuration:1027 - processing association prope
    rty references
    [java] 09:09:24,954 INFO Configuration:1049 - processing foreign key const
    raints
    [java] 09:09:24,985 WARN JDBCExceptionReporter:71 - SQL Error: 0, SQLState
    : S1002
    [java] 09:09:24,985 ERROR JDBCExceptionReporter:72 - [Microsoft][ODBC SQL S
    erver Driver]Invalid Descriptor Index
    [java] 09:09:25,001 ERROR SchemaValidator:129 - Error closing connection
    [java] java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid transaction state
    [java] Initial SessionFactory creation failed.org.hibernate.exception.Gener
    icJDBCException: could not get table metadata: Child
    [java] java.lang.ExceptionInInitializerError
    [java] at HibernateUtil.<clinit>(Unknown Source)
    [java] at PCManager.listEvents(Unknown Source)
    [java] at PCManager.main(Unknown Source)
    [java] Caused by: org.hibernate.exception.GenericJDBCException: could not g
    et table metadata: Child
    [java] at org.hibernate.exception.SQLStateConverter.handledNonSpecificE
    xception(SQLStateConverter.java:91)
    [java] at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6879)
    [java] at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7036)
    [java] at sun.jdbc.odbc.JdbcOdbc.SQLDisconnect(JdbcOdbc.java:2988)
    [java] at sun.jdbc.odbc.JdbcOdbcDriver.disconnect(JdbcOdbcDriver.java:9
    80)
    [java] at sun.jdbc.odbc.JdbcOdbcConnection.close(JdbcOdbcConnection.jav
    a:739)
    [java] at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaVal
    idator.java:125)
    [java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryIm
    pl.java:299)
    [java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configura
    tion.java:1145)
    [java] at HibernateUtil.<clinit>(Unknown Source)
    [java] at org.hibernate.exception.SQLStateConverter.convert(SQLStateCon
    verter.java:79)
    [java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExcep
    tionHelper.java:43)
    [java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExcep
    tionHelper.java:29)
    [java] at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(
    DatabaseMetadata.java:100)
    [java] at org.hibernate.cfg.Configuration.validateSchema(Configuration.
    java:946)
    [java] at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaVal
    idator.java:116)
    [java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryIm
    pl.java:299)
    [java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configura
    tion.java:1145)
    [java] ... 3 more
    [java] Caused by: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver
    ]Invalid Descriptor Index
    [java] at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6879)
    [java] at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7036)
    [java] at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3862)
    [java] at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultS
    et.java:5561)
    [java] at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.j
    ava:338)
    [java] at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.j
    ava:395)
    [java] at PCManager.listEvents(Unknown Source)
    [java] at PCManager.main(Unknown Source)
    [java] at org.hibernate.tool.hbm2ddl.TableMetadata.<init>(TableMetadata
    .java:30)
    [java] at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(
    DatabaseMetadata.java:85)
    [java] ... 7 more
    [java] Exception in thread "main"
    [java] Java Result: 1
    BUILD SUCCESSFUL
    Total time: 4 seconds
    Name and version of the database you are using:
    Microsoft SQLServer2000
    The generated SQL (show_sql=true):
    When the program is run with "hbm2ddl.auto" property as create, I get the following output.
    C:\Documents and Settings\mirza\Desktop\hibernate-3.1rc2\MyHibernate>ant run -Daction=store
    Buildfile: build.xml
    clean:
    [delete] Deleting directory C:\Documents and Settings\mirza\Desktop\hibernate
    -3.1rc2\MyHibernate\bin
    [mkdir] Created dir: C:\Documents and Settings\mirza\Desktop\hibernate-3.1rc
    2\MyHibernate\bin
    copy-resources:
    [copy] Copying 4 files to C:\Documents and Settings\mirza\Desktop\hibernate
    -3.1rc2\MyHibernate\bin
    compile:
    [javac] Compiling 5 source files to C:\Documents and Settings\mirza\Desktop\
    hibernate-3.1rc2\MyHibernate\bin
    run:
    [java] 09:12:54,820 INFO Environment:474 - Hibernate 3.1 rc2
    [java] 09:12:54,836 INFO Environment:489 - loaded properties from resource
    hibernate.properties: {hibernate.cglib.use_reflection_optimizer=true, hibernate
    .cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.dial
    ect=org.hibernate.dialect.SQLServerDialect, hibernate.max_fetch_depth=1, hiberna
    te.jdbc.use_streams_for_binary=true, hibernate.format_sql=true, hibernate.query.
    substitutions=yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.cac
    he.region_prefix=hibernate.test, hibernate.jdbc.batch_versioned_data=true, hiber
    nate.connection.pool_size=1}
    [java] 09:12:54,852 INFO Environment:519 - using java.io streams to persis
    t binary types
    [java] 09:12:54,852 INFO Environment:520 - using CGLIB reflection optimize
    r
    [java] 09:12:54,867 INFO Environment:550 - using JDK 1.4 java.sql.Timestam
    p handling
    [java] 09:12:54,946 INFO Configuration:1257 - configuring from resource: /
    hibernate.cfg.xml
    [java] 09:12:54,946 INFO Configuration:1234 - Configuration resource: /hib
    ernate.cfg.xml
    [java] 09:12:55,259 INFO Configuration:460 - Reading mappings from resourc
    e: PCMapping.hbm.xml
    [java] 09:12:55,400 INFO HbmBinder:266 - Mapping class: Parent -> Parent
    [java] 09:12:55,447 INFO HbmBinder:266 - Mapping class: Child -> Child
    [java] 09:12:55,447 INFO Configuration:1368 - Configured SessionFactory: n
    ull
    [java] 09:12:55,447 INFO Configuration:1014 - processing extends queue
    [java] 09:12:55,447 INFO Configuration:1018 - processing collection mappin
    gs
    [java] 09:12:55,447 INFO HbmBinder:2233 - Mapping collection: Parent.child
    ren -> Child
    [java] 09:12:55,463 INFO Configuration:1027 - processing association prope
    rty references
    [java] 09:12:55,479 INFO Configuration:1049 - processing foreign key const
    raints
    [java] 09:12:55,557 INFO DriverManagerConnectionProvider:41 - Using Hibern
    ate built-in connection pool (not for production use!)
    [java] 09:12:55,557 INFO DriverManagerConnectionProvider:42 - Hibernate co
    nnection pool size: 1
    [java] 09:12:55,557 INFO DriverManagerConnectionProvider:45 - autocommit m
    ode: false
    [java] 09:12:55,573 INFO DriverManagerConnectionProvider:80 - using driver
    : sun.jdbc.odbc.JdbcOdbcDriver at URL: jdbc:odbc:MySQL
    [java] 09:12:55,573 INFO DriverManagerConnectionProvider:86 - connection p
    roperties: {}
    [java] 09:12:55,651 INFO SettingsFactory:77 - RDBMS: Microsoft SQL Server,
    version: 08.00.0194
    [java] 09:12:55,667 INFO SettingsFactory:78 - JDBC driver: JDBC-ODBC Bridg
    e (SQLSRV32.DLL), version: 2.0001 (03.85.1117)
    [java] 09:12:55,682 INFO Dialect:100 - Using dialect: org.hibernate.dialec
    t.SQLServerDialect
    [java] 09:12:55,698 INFO TransactionFactoryFactory:31 - Using default tran
    saction strategy (direct JDBC transactions)
    [java] 09:12:55,714 INFO TransactionManagerLookupFactory:33 - No Transacti
    onManagerLookup configured (in JTA environment, use of read-write or transaction
    al second-level cache is not recommended)
    [java] 09:12:55,714 INFO SettingsFactory:125 - Automatic flush during befo
    reCompletion(): disabled
    [java] 09:12:55,714 INFO SettingsFactory:129 - Automatic session close at
    end of transaction: disabled
    [java] 09:12:55,729 INFO SettingsFactory:144 - Scrollable result sets: ena
    bled
    [java] 09:12:55,729 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): d
    isabled
    [java] 09:12:55,745 INFO SettingsFactory:160 - Connection release mode: au
    to
    [java] 09:12:55,745 INFO SettingsFactory:184 - Maximum outer join fetch de
    pth: 1
    [java] 09:12:55,745 INFO SettingsFactory:187 - Default batch fetch size: 1
    [java] 09:12:55,745 INFO SettingsFactory:191 - Generate SQL with comments:
    disabled
    [java] 09:12:55,745 INFO SettingsFactory:195 - Order SQL updates by primar
    y key: disabled
    [java] 09:12:55,745 INFO SettingsFactory:338 - Query translator: org.hiber
    nate.hql.ast.ASTQueryTranslatorFactory
    [java] 09:12:55,777 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTran
    slatorFactory
    [java] 09:12:55,792 INFO SettingsFactory:203 - Query language substitution
    s: {no='N', yes='Y'}
    [java] 09:12:55,792 INFO SettingsFactory:209 - Second-level cache: enabled
    [java] 09:12:55,792 INFO SettingsFactory:213 - Query cache: disabled
    [java] 09:12:55,792 INFO SettingsFactory:325 - Cache provider: org.hiberna
    te.cache.HashtableCacheProvider
    [java] 09:12:55,808 INFO SettingsFactory:228 - Optimize cache for minimal
    puts: disabled
    [java] 09:12:55,808 INFO SettingsFactory:233 - Cache region prefix: hibern
    ate.test
    [java] 09:12:55,808 INFO SettingsFactory:237 - Structured second-level cac
    he entries: disabled
    [java] 09:12:55,839 INFO SettingsFactory:257 - Echoing all SQL to stdout
    [java] 09:12:55,839 INFO SettingsFactory:264 - Statistics: disabled
    [java] 09:12:55,839 INFO SettingsFactory:268 - Deleted entity synthetic id
    entifier rollback: disabled
    [java] 09:12:55,839 INFO SettingsFactory:283 - Default entity-mode: POJO
    [java] 09:12:55,980 INFO SessionFactoryImpl:155 - building session factory
    [java] 09:12:56,325 INFO SessionFactoryObjectFactory:82 - Not binding fact
    ory to JNDI, no JNDI name configured
    [java] 09:12:56,341 INFO Configuration:1014 - processing extends queue
    [java] 09:12:56,341 INFO Configuration:1018 - processing collection mappin
    gs
    [java] 09:12:56,341 INFO Configuration:1027 - processing association prope
    rty references
    [java] 09:12:56,341 INFO Configuration:1049 - processing foreign key const
    raints
    [java] 09:12:56,356 INFO Configuration:1014 - processing extends queue
    [java] 09:12:56,356 INFO Configuration:1018 - processing collection mappin
    gs
    [java] 09:12:56,356 INFO Configuration:1027 - processing association prope
    rty references
    [java] 09:12:56,372 INFO Configuration:1049 - processing foreign key const
    raints
    [java] 09:12:56,372 INFO SchemaExport:153 - Running hbm2ddl schema export
    [java] 09:12:56,388 DEBUG SchemaExport:171 - import file not found: /import
    .sql
    [java] 09:12:56,388 INFO SchemaExport:180 - exporting generated schema to
    database
    [java] 09:12:56,403 DEBUG SchemaExport:283 -
    [java] alter table Child
    [java] drop constraint FK3E104FC976A59A
    [java] 09:12:56,466 DEBUG SchemaExport:283 -
    [java] drop table Child
    [java] 09:12:56,544 DEBUG SchemaExport:283 -
    [java] drop table Parent
    [java] 09:12:56,654 DEBUG SchemaExport:283 -
    [java] create table Child (
    [java] id numeric(19,0) identity not null,
    [java] name varchar(255) null,
    [java] parent_id numeric(19,0) null,
    [java] primary key (id)
    [java] )
    [java] 09:12:56,779 DEBUG SchemaExport:283 -
    [java] create table Parent (
    [java] id numeric(19,0) identity not null,
    [java] primary key (id)
    [java] )
    [java] 09:12:56,873 DEBUG SchemaExport:283 -
    [java] alter table Child
    [java] add constraint FK3E104FC976A59A
    [java] foreign key (parent_id)
    [java] references Parent
    [java] 09:12:56,952 INFO SchemaExport:200 - schema export complete
    [java] 09:12:56,952 WARN JDBCExceptionReporter:48 - SQL Warning: 5701, SQL
    State: 01000
    [java] 09:12:56,952 WARN JDBCExceptionReporter:49 - [Microsoft][ODBC SQL S
    erver Driver][SQL Server]Changed database context to 'master'.
    [java] 09:12:56,952 WARN JDBCExceptionReporter:48 - SQL Warning: 5703, SQL
    State: 01000
    [java] 09:12:56,952 WARN JDBCExceptionReporter:49 - [Microsoft][ODBC SQL S
    erver Driver][SQL Server]Changed language setting to us_english.
    [java] 09:12:56,983 INFO SessionFactoryImpl:432 - Checking 0 named queries
    [java] Hibernate:
    [java] insert
    [java] into
    [java] Child
    [java] (name)
    [java] values
    [java] (?) select
    [java] scope_identity()
    [java] Hibernate:
    [java] insert
    [java] into
    [java] Child
    [java] (name)
    [java] values
    [java] (?) select
    [java] scope_identity()
    [java] Hibernate:
    [java] insert
    [java] into
    [java] Child
    [java] (name)
    [java] values
    [java] (?) select
    [java] scope_identity()
    [java] Hibernate:
    [java] insert
    [java] into
    [java] Parent
    [java] default
    [java] values
    [java] select
    [java] scope_identity()
    [java] Hibernate:
    [java] update
    [java] Child
    [java] set
    [java] parent_id=?
    [java] where
    [java] id=?
    [java] Hibernate:
    [java] update
    [java] Child
    [java] set
    [java] parent_id=?
    [java] where
    [java] id=?
    [java] Hibernate:
    [java] update
    [java] Child
    [java] set
    [java] parent_id=?
    [java] where
    [java] id=?
    [java] 09:12:57,390 INFO SessionFactoryImpl:831 - closing
    [java] 09:12:57,390 INFO DriverManagerConnectionProvider:147 - cleaning up
    connection pool: jdbc:odbc:MySQL
    BUILD SUCCESSFUL
    Total time: 5 seconds
    Debug level Hibernate log excerpt:
    Included in the above description.

    That's not the right mapping for the 1:m relationship in Hibernate.
    First of all, I believe the recommendation is to have a separate .hbm.xml file for each class, so you should have one for Parent and Child.
    Second, you'll find the proper syntax for a one-to-many relationship here:
    http://www.hibernate.org/hib_docs/v3/reference/en/html/tutorial.html#tutorial-associations
    See if those help.
    The tutorial docs for Hibernate are quite good. I'd recommend going through them carefully.
    %

  • How to use composite entities which driven by different PU via hibernate

    Hi experts,
    There are 2 different persistence unit in my project.
    PU_A: Application entities, that can execute all crud operations.
    PU_B: This one has some views which contains outside data. I can just read data from here
    But i want to create foreign key in some entities which are in PU_A by using immutable-entity which managed by PU_B persistence-unit.
    If you could view on following snippets. I have IncomingPaperwork entity which is driven by PU_A and ProjectView which is driven by PU_B.
    After i applied this issue; When deploy the application exception that is below occured :
    30-Jan-2013 15:13:05 o'clock EET> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
    weblogic.application.ModuleException:
         at weblogic.ejb.container.deployer.EJBModule$1.execute(EJBModule.java:326)
         at weblogic.deployment.PersistenceUnitRegistryInitializer.setupPersistenceUnitRegistries(PersistenceUnitRegistryInitializer.java:62)
         at weblogic.servlet.internal.WebAppModule.initPersistenceUnitRegistry(WebAppModule.java:411)
         at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:365)
         at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)
         Truncated. see log file for complete stacktrace
    Caused By: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.acme.model.entity.IncomingPaperwork.projectView references an unknown entity: com.acme.integrationmodel.entity.ProjectView
         at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:81)
         at org.hibernate.cfg.AnnotationConfiguration.processEndOfQueue(AnnotationConfiguration.java:456)
         at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:438)
         at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:309)
         at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1162)
         Truncated. see log file for complete stacktrace
    >
    [03:13:05 PM] #### Deployment incomplete. ####
    Is there a way to achieve this? Any suggestions?
    Thanks in advance
    ___persistence.xml___
    <persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
    version="2.0">
    <persistence-unit name="PU_A" transaction-type="JTA">
    <description>This unit manages all application entities</description>
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta-data-source>jdbc/A_DS</jta-data-source>
    <class>com.acme.model.entity.IncomingPaperwork</class>
    <properties>
    <property name="hibernate.jndi.url" value="t3://localhost:7101"/>
    <!--DataSource-->
    <property name="hibernate.connection.datasource"
    value="jdbc/A_DS"/>
    <property name="hibernate.transaction.manager_lookup_class"
    value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
    <property name="hibernate.dialect"
    value="org.hibernate.dialect.Oracle10gDialect"/>
    <property name="hibernate.hbm2ddl.auto" value="update"/>
    <property name="hibernate.show_sql" value="true"/>
    <property name="hibernate.format_sql" value="true"/>
    <property name="hibernate.use_sql_comments" value="true"/>
    <property name="hibernate.current_session_context_class" value="jta"/>
    <property name="hibernate.archive.autodetection" value="jar,class"/>
    </properties>
    </persistence-unit>
    <persistence-unit name="PU_B" transaction-type="JTA">
    <description>This unit manages all integration entities</description>
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta-data-source>jdbc/B_DS</jta-data-source>
    <class>com.acme.integrationmodel.entity.ProjectView</class>
    <properties>
    <property name="hibernate.jndi.url" value="t3://localhost:7101"/>
    <!--DataSource-->
    <property name="hibernate.connection.datasource"
    value="jdbc/B_DS"/>
    <property name="hibernate.transaction.manager_lookup_class"
    value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
    <property name="hibernate.dialect"
    value="org.hibernate.dialect.Oracle10gDialect"/>
    <property name="hibernate.hbm2ddl.auto" value="validate"/>
    <property name="hibernate.show_sql" value="true"/>
    <property name="hibernate.format_sql" value="true"/>
    <property name="hibernate.use_sql_comments" value="true"/>
    <property name="hibernate.current_session_context_class" value="jta"/>
    </properties>
    </persistence-unit>
    </persistence>
    ___IncomingPaperwork.class___
    import com.arsivist.structure.BaseEntity;
    import com.acme.integrationmodel.entity.ProjectView;
    import com.acme.model.entity.listener.EntityListener;
    import com.acme.model.entity.listener.IncomingPaperworkListener;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.EntityListeners;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.JoinColumn;
    import javax.persistence.ManyToOne;
    import javax.persistence.SequenceGenerator;
    import javax.persistence.Table;
    @Entity(name = "IncomingPaperwork")
    @Table(name = "INCOMINGPAPERWORKS")
    @SequenceGenerator(name = "INCOMINGPAPERWORK_SEQ", sequenceName = "INCOMINGPAPERWORK_SEQ", allocationSize = 1)
    @EntityListeners( { EntityListener.class, IncomingPaperworkListener.class })
    public class IncomingPaperwork extends BaseEntity
    private Company company;
    private ProjectView projectView;
    public IncomingPaperwork()
    entityName = "IncomingPaperwork";
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "INCOMINGPAPERWORK_SEQ")
    @Column(name = "ID")
    public int getId()
    return id;
    public void setId(int id)
    this.id = id;
    public void setCompany(Company company)
    this.company = company;
    @ManyToOne(targetEntity = com.acme.model.entity.Company.class, cascade = { })
    @JoinColumn(name = "COMPANYID", nullable = false)
    public Company getCompany()
    return company;
    public void setProjectView(ProjectView projectView)
    this.projectView = projectView;
    @ManyToOne(targetEntity = com.acme.integrationmodel.entity.ProjectView.class, cascade = { })
    @JoinColumn(name = "PROJECTVIEWID")
    public ProjectView getProjectView()
    return projectView;
    ___ProjectView.class___
    import com.arsivist.structure.BaseEntityView;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import org.hibernate.annotations.Immutable;
    import org.hibernate.annotations.Subselect;
    @Entity(name = "ProjectView")
    @Immutable
    @Subselect("SELECT * FROM ProjectView")
    public class ProjectView extends BaseEntityView
    private String code;
    private String name;
    public ProjectView()
    entityName = "ProjectView";
    public ProjectView(int id, String name)
    entityName = "ProjectView";
    this.id = id;
    this.name = name;
    @Id
    @Column(name = "ID")
    public int getId()
    return id;
    public void setId(int id)
    this.id = id;
    public void setCode(String code)
    this.code = code;
    @Column(name = "CODE")
    public String getCode()
    return code;
    public void setName(String name)
    this.name = name;
    @Column(name = "NAME")
    public String getName()
    return name;
    @Override
    public String toString()
    return "" + getName();
    Edited by: webyildirim on Jan 30, 2013 5:36 AM

    Not quite what I meant - I was suggesting you load the entity immediately after reading it from PU_B, or anytime before associating it into PU_A, so before the merge. What you have not shown though is any code on how you are obtaining IntegrationDepartment and integrating it into PU_A, or what you mean by it is returning a refreshed version of Topic. This problem could also be the result of how your provider works internally - this is a TopLink/EclipseLink forum post so I cannot really tell you why you get the exception other than it would be expected to work as described with EclipseLink as the JPA provider.
    So the best suggestions I can come up with are prefetch your entity, try posting in a hibernate forum, or try using EclipseLink/TopLink so someone here might be better able to help you with any problems that arise.
    Best Regards,
    Chris

  • Configuring JDBC in jboss-4.0.4.GA

    I'm using JBoss-4.0.4.GA, Eclipse 3.1 and MS SQL Server2005.
    To configure JBoss with MSSQL datasource I made the following:
    Copy sqljdbc.jar and put them in server\default\lib direcroty.
    I also copy the mssql-ds.xml from \docs\examples\jca\ and modify it according to my specification and put it in deploy directory of default server.
    My DataSource is as Follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <datasources>
    <local-tx-datasource>
    <jndi-name>regDataSource</jndi-name>
    <connection-url>jdbc:sqlserver://localhost:1433;databaseName=Ereg;</connection-url>
    <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
    <user-name>sa</user-name>
    <password>royal</password>
    <metadata>
    <type-mapping>MS SQLSERVER2005</type-mapping>
    </metadata>
    </local-tx-datasource>
    </datasources>
    When i build my application, i get the following exceptions......
    [b]org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect)
         at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:177)
         at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:539)
         at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:228)
         at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:417)
         at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:324)
         at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:301)
         at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:379)
         at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:812)
         at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
         at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
         at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:73)
         at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1928)
         at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1211)
         at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:631)
         at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:760)
         at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:350)
         at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:119)
         at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:99)
         at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
         at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
         at sun.reflect.GeneratedMethodAccessor300.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
         at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
         at $Proxy0.start(Unknown Source)
         at org.jboss.system.ServiceController.start(ServiceController.java:417)
         at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
         at $Proxy420.start(Unknown Source)
         at org.jboss.ejb3.JmxKernelAbstraction.install(JmxKernelAbstraction.java:82)
         at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:626)
         at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:475)
         at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:139)
         at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
         at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
         at sun.reflect.GeneratedMethodAccessor300.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
         at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
         at $Proxy0.start(Unknown Source)
         at org.jboss.system.ServiceController.start(ServiceController.java:417)
         at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
         at $Proxy43.start(Unknown Source)
         at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:449)
         at sun.reflect.GeneratedMethodAccessor203.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
         at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
         at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
         at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
         at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
         at org.jboss.ws.server.WebServiceDeployer.start(WebServiceDeployer.java:117)
         at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
         at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
         at $Proxy44.start(Unknown Source)
         at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1007)
         at org.jboss.deployment.MainDeployer.start(MainDeployer.java:997)
         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:808)
         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771)
         at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
         at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
         at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
         at $Proxy6.deploy(Unknown Source)
         at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
         at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
         at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
         at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
         at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
    Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect
         at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
         at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
         at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:169)
         ... 113 more
    Thanx in advance.

    Enable TCP/IP protocol. Select Microsoft SQL Server 2005>Configuration Tools>SQL Server Configuration Manager. In the SQL Server Configuration Manager select the node SQL Server 2005 Network Configuration>Protocols for SQLEXPRESS. Right-click on the TCP/IP node and select Enable. Restart the SQL Server (SQLEXPRESS) service. Right-click on the SQL Server (SQLEXPRESS) service in Services and select Restart.

  • Hibernate Error in JDeveloper

    Hi,
    I am developing a Hibernate based application, and I have been going thru some sample application to understand how to go about it.
    While running one of the sample applications, I get the following error. I have tried placing the slf4j-api-1.5.2.jar in the classpath,
    in the jdeveloper lib path. But I keep getting the following error.
    Please let me know if there is any additional step required to configure and deploy Hibernate in Jdeveloper.
    I am using JDeveloper 10.1.3.4
    oracle.classloader.util.AnnotatedNoClassDefFoundError:
           Missing class: org.slf4j.impl.StaticLoggerBinder
         Dependent class: org.slf4j.LoggerFactory
                  Loader: jre.extension:0.0.0
             Code-Source: /C:/jdeveloper10134/jdk/jre/lib/ext/slf4j-api-1.5.2.jar
           Configuration: system property java.ext.dirs
    The missing class is not available from any code-source or loader in the system.     at
    oracle.classloader.PolicyClassLoader.handleClassNotFound (PolicyClassLoader.java:2068)
    [/C:/jdeveloper10134/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@14916158]     
    at oracle.classloader.PolicyClassLoader.internalLoadClass (PolicyClassLoader.java:1679) [/C:/jdeveloper10134/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@14916158]     
    at oracle.classloader.PolicyClassLoader.loadClass (PolicyClassLoader.java:1635) [/C:/jdeveloper10134/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@14916158]     
    at oracle.classloader.PolicyClassLoader.loadClass (PolicyClassLoader.java:1620) [/C:/jdeveloper10134/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@14916158]     
    at java.lang.ClassLoader.loadClassInternal (ClassLoader.java:319) [jre bootstrap, by jre.bootstrap:1.5.0_06]     
    at org.slf4j.LoggerFactory.<clinit> (LoggerFactory.java:60) [/C:/jdeveloper10134/jdk/jre/lib/ext/slf4j-api-1.5.2.jar (from system property java.ext.dirs), by jre.extension:0.0.0]     
    at org.hibernate.cfg.Configuration.<clinit> (Configuration.java:151) [/C:/softwares/libraries/Hibernate/hibernate-distribution-3.3.1.GA-dist/hibernate-distribution-3.3.1.GA/hibernate3.jar (from <classpath> in C:\WorkSpace\JDeveloperWorkSpace\HibernateTest\HibernateTestWs\public_html), by current-workspace-app.web.HibernateTest-HibernateTestWs-webapp:0.0.0]     at com.demo.HibernateServlet.$init$ (HibernateServlet.java:22) [/C:/WorkSpace/JDeveloperWorkSpace/HibernateTest/HibernateTestWs/classes/ (from <classpath> in C:\WorkSpace\JDeveloperWorkSpace\HibernateTest\HibernateTestWs\public_html), by current-workspace-app.web.HibernateTest-HibernateTestWs-webapp:0.0.0]     
    at com.demo.HibernateServlet.<init> (HibernateServlet.java:19) [/C:/WorkSpace/JDeveloperWorkSpace/HibernateTest/HibernateTestWs/classes/ (from <classpath> in C:\WorkSpace\JDeveloperWorkSpace\HibernateTest\HibernateTestWs\public_html), by current-workspace-app.web.HibernateTest-HibernateTestWs-webapp:0.0.0]     
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native method) [unknown, by unknown]     
    at sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:39) [unknown, by unknown]     
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:27) [unknown, by unknown]     
    at java.lang.reflect.Constructor.newInstance (Constructor.java:494) [unknown, by unknown]     
    at java.lang.Class.newInstance0 (Class.java:350) [jre bootstrap, by jre.bootstrap:1.5.0_06]     
    at java.lang.Class.newInstance (Class.java:303) [jre bootstrap, by jre.bootstrap:1.5.0_06]     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpApplication.loadServlet (HttpApplication.java:2346) [jre bootstrap, by jre.bootstrap:1.5.0_06]     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpApplication.findServlet (HttpApplication.java:4830) [jre bootstrap, by jre.bootstrap:1.5.0_06]     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpApplication.findServlet (HttpApplication.java:4754) [jre bootstrap, by jre.bootstrap:1.5.0_06]     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpApplication.getRequestDispatcher (HttpApplication.java:2978) [/C:/jdeveloper10134/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in C:\jdeveloper10134\j2ee\home\oc4j.jar), by oc4j:10.1.3]     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpRequestHandler.doProcessRequest (HttpRequestHandler.java:738) [/C:/jdeveloper10134/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in C:\jdeveloper10134\j2ee\home\oc4j.jar), by oc4j:10.1.3]     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpRequestHandler.processRequest (HttpRequestHandler.java:453) [/C:/jdeveloper10134/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in C:\jdeveloper10134\j2ee\home\oc4j.jar), by oc4j:10.1.3]     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpRequestHandler.serveOneRequest (HttpRequestHandler.java:221) [/C:/jdeveloper10134/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in C:\jdeveloper10134\j2ee\home\oc4j.jar), by oc4j:10.1.3]     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpRequestHandler.run (HttpRequestHandler.java:122) [/C:/jdeveloper10134/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in C:\jdeveloper10134\j2ee\home\oc4j.jar), by oc4j:10.1.3]     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpRequestHandler.run (HttpRequestHandler.java:111) [/C:/jdeveloper10134/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in C:\jdeveloper10134\j2ee\home\oc4j.jar), by oc4j:10.1.3]     
    at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run (ServerSocketReadHandler.java:260) [/C:/jdeveloper10134/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in C:\jdeveloper10134\j2ee\home\oc4j.jar), by oc4j:10.1.3]     
    at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket (ServerSocketAcceptHandler.java:234) [/C:/jdeveloper10134/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in C:\jdeveloper10134\j2ee\home\oc4j.jar), by oc4j:10.1.3]     
    at oracle.oc4j.network.ServerSocketAcceptHandler.access$700 (ServerSocketAcceptHandler.java:29) [/C:/jdeveloper10134/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in C:\jdeveloper10134\j2ee\home\oc4j.jar), by oc4j:10.1.3]     
    at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run (ServerSocketAcceptHandler.java:879) [/C:/jdeveloper10134/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in C:\jdeveloper10134\j2ee\home\oc4j.jar), by oc4j:10.1.3]     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run (ReleasableResourcePooledExecutor.java:298) [/C:/jdeveloper10134/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in C:\jdeveloper10134\j2ee\home\oc4j.jar), by oc4j:10.1.3]     
    at java.lang.Thread.run (Thread.java:595) [/C:/jdeveloper10134/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in C:\jdeveloper10134\j2ee\home\oc4j.jar), by oc4j:10.1.3]
    {code}
    Thanks,
    Rishikesh R                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    I was able to figure out the reason for this error.
    The jar file slf4j-api-1.5.2.jar supplied with the hibernate download does not contain all the class files. On using the jar file downloaded from the website, [http://www.slf4j.org/download.html|http://www.slf4j.org/download.html] ,
    I am able to run the sample hibernate example without any error.
    Hope this helps anybody who faces a similar error.
    Thanks,
    Rishikesh R.

  • How to deploy hibernate application in Oracle Content Management  SDK?

    Hi All,
    I have a hibernate application which is perfectly working in Tomcat Server. I need to deploy the application under an OC4J Instance of Oracle Content Management SDK.
    I have deployed the application under one OC4J Instance, but when I submitting the login page of the application, some errors are coming. The error is given below.
    06/03/16 16:16:43 Started
    06/03/16 16:17:04 vidushiapp: jsp: init
    06/03/16 16:17:04 vidushiapp: LOGGING: init
    06/03/16 16:17:04 vidushiapp: LOGGING: [WebStarterAppServlet 1] init() called.
    06/03/16 16:17:04 vidushiapp: Started
    06/03/16 16:17:06 vidushiapp: NodeGuardian:
    06/03/16 16:17:06 vidushiapp: NodeGuardian: Oracle Content Management SDK
    06/03/16 16:17:06 vidushiapp: NodeGuardian: Node Guardian 9.0.4.2.2
    06/03/16 16:17:06 vidushiapp: NodeGuardian: Copyright (c) 2000, 2004 Oracle. All rights reserved.
    06/03/16 16:17:06 vidushiapp: NodeGuardian:
    06/03/16 16:17:06 vidushiapp: NodeGuardian: Domain = ifs://ritesh:1521:CMSDK.daffodildb.com:CM_SCHEMA
    06/03/16 16:17:06 vidushiapp: NodeGuardian: Node = Sample2HttpNode
    06/03/16 16:17:06 vidushiapp: NodeGuardian: ProcessId = 1456
    06/03/16 16:17:06 vidushiapp: NodeGuardian: Guarded = false
    06/03/16 16:17:06 vidushiapp: NodeGuardian: JavaCommand = java
    06/03/16 16:17:06 vidushiapp: NodeGuardian: LogLevel = 4
    06/03/16 16:17:06 vidushiapp: NodeGuardian: RemoterLogLevel = 2
    06/03/16 16:17:06 vidushiapp: NodeGuardian: LogRotationPeriod = 0
    06/03/16 16:17:06 vidushiapp: NodeGuardian:
    06/03/16 16:17:06 vidushiapp: NodeGuardian: Creating E:/OraHome/ifs/cmsdk\log\ritesh_1521_CMSDK_daffodildb_com_CM_SCHEMA\Sample2HttpNode_HTTPNodeGuardian.pid file
    06/03/16 16:17:06 vidushiapp: NodeGuardian: RemoterType = SocketRemoter
    06/03/16 16:17:06 vidushiapp: NodeGuardian: GuardianLocator = ifs_socket://admin:53153
    06/03/16 16:17:06 vidushiapp: SocketRemoter: Listening on 192.168.0.241:53153
    06/03/16 16:17:06 vidushiapp: SocketRemoter: Initialized
    06/03/16 16:17:06 vidushiapp: NodeGuardian: Ready
    06/03/16 16:17:13 vidushiapp: NodeGuardian: Unguarded node manager started as Sample2HttpNode
    06/03/16 16:17:13 vidushiapp: NodeManager:
    06/03/16 16:17:13 vidushiapp: NodeManager: Oracle Content Management SDK
    06/03/16 16:17:13 vidushiapp: NodeManager: Node Manager 9.0.4.2.2
    06/03/16 16:17:13 vidushiapp: NodeManager: Copyright (c) 2000, 2004 Oracle. All rights reserved.
    06/03/16 16:17:13 vidushiapp: NodeManager:
    06/03/16 16:17:13 vidushiapp: NodeManager: Domain = ifs://ritesh:1521:CMSDK.daffodildb.com:CM_SCHEMA
    06/03/16 16:17:13 vidushiapp: NodeManager: Node = Sample2HttpNode
    06/03/16 16:17:13 vidushiapp: NodeManager: ProcessId = 1456
    06/03/16 16:17:13 vidushiapp: NodeManager: DomainController Locator = ifs_socket://admin:53140
    06/03/16 16:17:13 vidushiapp: NodeManager: Oracle Home = E:/OraHome
    06/03/16 16:17:13 vidushiapp: NodeManager: CM SDK Home = E:/OraHome/ifs/cmsdk
    06/03/16 16:17:13 vidushiapp: NodeManager: LogLevel = 4
    06/03/16 16:17:13 vidushiapp: NodeManager: RemoterLogLevel = 2
    06/03/16 16:17:13 vidushiapp: NodeManager:
    06/03/16 16:17:13 vidushiapp: NodeManager: RemoterType = SocketRemoter
    06/03/16 16:17:13 vidushiapp: NodeManager: ManagerLocator = ifs_socket://admin:53154
    06/03/16 16:17:13 vidushiapp: SocketRemoter: Listening on 192.168.0.241:53154
    06/03/16 16:17:13 vidushiapp: SocketRemoter: Initialized
    06/03/16 16:17:14 vidushiapp: NodeGuardian: Log level set to 4
    06/03/16 16:17:14 vidushiapp: NodeManager: Log level set to 4
    06/03/16 16:17:14 vidushiapp: NodeGuardian: Remoter log level set to 2
    06/03/16 16:17:14 vidushiapp: NodeManager: Remoter log level set to 2
    06/03/16 16:17:14 vidushiapp: NodeGuardian: Node manager registered
    06/03/16 16:17:14 vidushiapp: NodeManager: Ready
    06/03/16 16:17:14 vidushiapp: NodeManager: Initialize: determining default services and servers
    06/03/16 16:17:14 vidushiapp: NodeManager: Initialize: starting service IfsDefaultService
    06/03/16 16:17:53 vidushiapp: NodeManager: Service IfsDefaultService started
    06/03/16 16:17:53 vidushiapp: NodeManager: Initialize: loading server WebStarterAppServer
    06/03/16 16:17:54 vidushiapp: NodeManager: Server WebStarterAppServer loaded
    06/03/16 16:17:54 vidushiapp: NodeManager: Initialize: setting priority of server WebStarterAppServer to 5
    06/03/16 16:17:54 vidushiapp: WebStarterAppServer: Priority change requested (old priority 5, new priority 5)
    06/03/16 16:17:54 vidushiapp: NodeManager: Initialize: starting server WebStarterAppServer
    06/03/16 16:17:54 vidushiapp: WebStarterAppServer: Requested to start
    06/03/16 16:17:54 vidushiapp: NodeManager: Initialize: loading server DavServer
    06/03/16 16:17:54 vidushiapp: WebStarterAppServer: Starting
    06/03/16 16:17:55 vidushiapp: WebStarterAppServer: WebStarterAppServer registered under WebStarterAppServer
    06/03/16 16:17:55 vidushiapp: WebStarterAppServer: Started
    06/03/16 16:17:55 vidushiapp: WebStarterAppServer: WebStarterAppServer: run called
    06/03/16 16:18:13 vidushiapp: NodeManager: Server DavServer loaded
    06/03/16 16:18:13 vidushiapp: NodeManager: Initialize: setting priority of server DavServer to 5
    06/03/16 16:18:13 vidushiapp: DavServer: Priority change requested (old priority 5, new priority 5)
    06/03/16 16:18:13 vidushiapp: NodeManager: Initialize: starting server DavServer
    06/03/16 16:18:13 vidushiapp: DavServer: Requested to start
    06/03/16 16:18:14 vidushiapp: NodeManager: Initialize: loading server ServiceWarmupAgent
    06/03/16 16:18:14 vidushiapp: DavServer: Starting
    06/03/16 16:18:14 vidushiapp: DavServer: Started
    06/03/16 16:18:14 vidushiapp: NodeManager: Server ServiceWarmupAgent loaded
    06/03/16 16:18:14 vidushiapp: NodeManager: Initialize: setting priority of server ServiceWarmupAgent to 5
    06/03/16 16:18:14 vidushiapp: ServiceWarmupAgent: Priority change requested (old priority 5, new priority 5)
    06/03/16 16:18:14 vidushiapp: NodeManager: Initialize: starting server ServiceWarmupAgent
    06/03/16 16:18:14 vidushiapp: ServiceWarmupAgent: Requested to start
    06/03/16 16:18:14 vidushiapp: NodeManager: Initialize: complete
    06/03/16 16:18:14 vidushiapp: ServiceWarmupAgent: Starting
    06/03/16 16:18:14 vidushiapp: ServiceWarmupAgent: Started
    06/03/16 16:18:14 vidushiapp: ServiceWarmupAgent: Starting
    06/03/16 16:18:14 vidushiapp: ServiceWarmupAgent: Service warmup starting
    06/03/16 16:18:14 vidushiapp: ServiceWarmupAgent: set administration mode
    06/03/16 16:18:14 vidushiapp: ServiceWarmupAgent: warming up Format cache
    06/03/16 16:18:14 vidushiapp: ServiceWarmupAgent: warming up Media cache
    06/03/16 16:18:14 vidushiapp: ServiceWarmupAgent: Service warmup complete
    06/03/16 16:18:14 vidushiapp: ServiceWarmupAgent: Stopping Service Warmup Agent
    06/03/16 16:18:14 vidushiapp: ServiceWarmupAgent: Requested to stop
    06/03/16 16:18:14 vidushiapp: ServiceWarmupAgent: Stopping
    06/03/16 16:18:14 vidushiapp: ServiceWarmupAgent: Timer stopped
    06/03/16 16:18:14 vidushiapp: ServiceWarmupAgent: postRun
    06/03/16 16:18:14 vidushiapp: ServiceWarmupAgent: Stopped
    06/03/16 16:18:50 vidushiapp: Servlet error
    javax.faces.FacesException: Error calling action method of component with id id32:id45
         at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
         at javax.faces.component.UICommand.broadcast(UICommand.java:106)
         at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
         at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:271)
         at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:94)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
    Caused by: javax.faces.el.EvaluationException: Exception while invoking expression #{UserValidation.validateUser}
         at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153)
         at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
         ... 15 more
    Caused by: java.lang.ExceptionInInitializerError
         at com.daffodilwoods.framework.queryexecuter.HibernateUtil.<clinit>(HibernateUtil.java:66)
         at com.daffodilwoods.framework.validation.UserValidation.validateUser(UserValidation.java:23)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
         ... 16 more
    Caused by: java.lang.ExceptionInInitializerError
         at com.mchange.v2.c3p0.PoolConfig.<clinit>(PoolConfig.java:93)
         at org.hibernate.connection.C3P0ConnectionProvider.configure(C3P0ConnectionProvider.java:84)
         at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:80)
         at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:362)
         at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)
         at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
         at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)
         at com.daffodilwoods.framework.queryexecuter.HibernateUtil.<clinit>(HibernateUtil.java:62)
         ... 22 more
    Caused by: java.lang.ClassCastException
         at com.mchange.v2.cfg.BasicMultiPropertiesConfig.extractPropsByKey(BasicMultiPropertiesConfig.java:150)
         at com.mchange.v2.cfg.BasicMultiPropertiesConfig.<init>(BasicMultiPropertiesConfig.java:101)
         at com.mchange.v2.cfg.BasicMultiPropertiesConfig.<init>(BasicMultiPropertiesConfig.java:39)
         at com.mchange.v2.cfg.MultiPropertiesConfig.read(MultiPropertiesConfig.java:64)
         at com.mchange.v2.cfg.MultiPropertiesConfig.readVmConfig(MultiPropertiesConfig.java:73)
         at com.mchange.v2.log.MLog.<clinit>(MLog.java:48)
         ... 30 more
    I think there is some thing missing in my configurations. Can you please tell how to deploy and run a hibernate application. Is there any problem occurs while accessing another DataBase from Oracle Content Management? What are the setting I have to do for running a hibernate application from Oracle CMSDK?
    Thanks in advance
    Basil

    Hi,
    I got the solution for my problem. The error came because of the hibernate pooling. I removed the hibernate pooling lines from my hibernate configuration file and it is working fine.lines
    Thanks
    Basil

  • Problem in hibernate mapping

    Hi,
    I am new to hibernate and found some problem in mapping for a simple example. Kindly have a look at my code and stack trace and help me fix the problem.
    Mobile.hbm.xml
    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <hibernate-mapping>
         <class name="com.mindtree.entity.MobileInvoice" table="MOBILE">
              <property name="model" column="MODEL"/>
              <property name="make" column="MAKE"/>
              <property name="price" column="PRICE"/>
              <property name="date" column="DATE1" />
              <property name="csex" column="CSEX" />
              <property name="cage" column= "CAGE" />
              <id name="id" column="ID">
                   <generator class="increment"/>
              </id>
         </class>
    </hibernate-mapping>Stacktrace:
    org.hibernate.MappingException: Could not read mappings from resource: Mobile.hbm.xml
         at org.hibernate.cfg.Configuration.addResource(Configuration.java:485)
         at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)
         at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
         at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
         at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
         at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
         at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
         at com.mindtree.dao.MobileDAOImpl.addInvoice(MobileDAOImpl.java:25)
         at com.mindtree.dao.Test.main(Test.java:18)
    Caused by: org.hibernate.MappingException: invalid mapping
         at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:425)
         at org.hibernate.cfg.Configuration.addResource(Configuration.java:482)
         ... 8 more
    Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(query|sql-query)*)".
         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.handleEndElement(Unknown Source)
         at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
         at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(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:465)
         at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:422)
         ... 9 moreThanks :)

    for ex:
    hibernate.cfg.xml
    <mapping resource="com/spm/dao/Login.hbm.xml" />
    login.hbm.xml
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <hibernate-mapping>
         <class name="com.dao.Login" table="login">
              <id name="id" type="java.lang.Short">
                   <column name="id" />
                   <generator class="increment" />
              </id>
              <property name="username" type="java.lang.String">
                   <column name="username" length="15" not-null="true" />
              </property>
         </class>
    </hibernate-mapping>

Maybe you are looking for