-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: jboss 4.2.3 and hibernate programmatic configuration
PostPosted: Fri Nov 21, 2008 10:59 am 
Newbie

Joined: Fri Nov 21, 2008 10:43 am
Posts: 3
I use jboss 4.2.3
In my mbean I have:

Code:
try {

            new Configuration()
                    .addXML(mappings)
                    .setProperty("hibernate.session_factory_name", "hibernate/Test")
                    .setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect")
                    .setProperty("hibernate.connection.datasource", "java:/db")
                    .setProperty("hbm2ddl.auto", "update")
                    .setProperty("current_session_context_class", "thread").buildSessionFactory();
        } catch (Exception e) {
            e.printStackTrace();
        }



where mappings is:

Code:
<?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="foo.Client">
      <id name="id"
          type="long"
        column="id">
          <generator class="increment"/>
      </id>
      <property name="name"
          type="string"/>
      <property name="pasport"
          type="java.lang.String"/>
      <property name="inn"
          type="java.lang.String"/>
      <property name="kpp"
          type="java.lang.String"/>
      <property name="comment"
          type="java.lang.String"/>
  </class>

  <class name="foo.Goods">
      <id name="id"
          type="long"
        column="id">
          <generator class="increment"/>
      </id>
      <property name="name"
          type="string"/>
      <property name="PrintName"
          type="java.lang.String"/>
  </class>

</hibernate-mapping>




Code:
I recieve

org.apache.xerces.parsers.ObjectFactory$ConfigurationError: Provider PK not found
   at org.apache.xerces.parsers.ObjectFactory.newInstance(Unknown Source)
   at org.apache.xerces.parsers.ObjectFactory.findJarServiceProvider(Unknown Source)
   at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
   at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
   at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
   at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
   at java.lang.Class.newInstance0(Class.java:355)
   at java.lang.Class.newInstance(Class.java:308)
   at org.xml.sax.helpers.NewInstance.newInstance(NewInstance.java:51)
   at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:187)
   at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:150)
   at org.dom4j.io.SAXHelper.createXMLReader(SAXHelper.java:83)
   at org.dom4j.io.SAXReader.createXMLReader(SAXReader.java:894)
   at org.dom4j.io.SAXReader.getXMLReader(SAXReader.java:715)
   at org.dom4j.io.SAXReader.read(SAXReader.java:435)
   at org.dom4j.io.SAXReader.read(SAXReader.java:365)
   at org.hibernate.cfg.Configuration.addXML(Configuration.java:435)



when my code is executed. If I put xerces.2.6.2.jar from hibernate distribution into /deploy/ dir, it works well, but I can't redeploy anything because jboss complains that it can't parse xml.


How can I make configuration with mappings in string?


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

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.