Hibernate.cfg.xml configuration

Hi
  I have written hibernate.cfg.xml ,for connecting to the
data base i am using data sources concept.
  I have one property in hibernate.cfg.xml
  <property name="connection.datasource">.......</property>
  Can any tell how to give the datasource name in the property tag.
  My Data source is residing in another system
I am using MAXDB as backend
thanks and regards
Satyam

Hi Satyam,
Check <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/bf0d57db-0c01-0010-6fa3-83503981eed4">Run Hibernate on the SAP J2EE Platform</a>
Best regards, Maksim Rashchynski.

Similar Messages

  • 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-

  • Hibernate+10gAS: hibernate.cfg.xml not found in classpath

    Hi
    We are using Hibernate. It requieres a configuration file (hibernate.cfg.xml) to be present
    somewhere in the classpath. That works when running the application in the IDE (JDeveloper
    10g), keeping the file in the WEBINF directory. However, when we deploy the application in 10g
    App Server, the file is not found. We have tried storing it everywhere in the class path, but
    no mather were we put it, it is not found.
    Any clues?
    TIA,
    Brian

    try asking this on the OC4J forum:
    OC4J

  • Problem in placing hibernate.cfg.xml

    Hi,
      I have written one ejb project with hibernate in my net weaver.Now i have a problem in placing hibernate.cfg.xml.so tell me where to place it .Give some examples related to that and some related links.

    Hi,
    you can place it into the root of the EJB project as your EJBs probably access Hibernate as persistence layer. In this case make sure that you pass the string "hibernate.cfg.xml" within the method invocation when retrieving a SessionFactory as follows:
    try
    Configuration cfg = new Configuration();
    sessionFactory = cfg.configure 
         ("hibernate.cfg.xml").buildSessionFactory();
    catch (Throwable ex)
    Otherwise the Configuration file may not be found by the application class loader due to different path syntax.
    For further information you can refer to this https://www.sdn.sap.com/irj/sdn/developerareas/java?rid=/webcontent/uuid/e081a4b6-0801-0010-7fa4-c3c7a0454815#hibernate [original link is broken] [original link is broken], although the hibernate.cfg.xml file is placed in the Web-Project in this example.
    Hope this helps,
    Best regards,
    Robin

  • Web Dynpro: Where put hibernate hibernate.cfg.xml?

    I have seen several people asking about the place to put the config file of Hibernate, but not any conclusive answer until now...
       I created a external library in WAS (I verified using Visual Admin that the lib was correctly deployed). In my Web Dynpro References -> Library Reference I add the library in the format Provider Name/Library Name: "sap.com/hiblibs"
    <b>  Where can I store the hibernate.cfg.xml?</b> I have tried put it in all web dynpro folders!
    Thanks,
    Ivan Garcia
    From Brazil
    <b>  This is my source code:</b> 
      Configuration cfg = new Configuration();
      cfg.configure("hibernate.conf.xml");
    <b>  The error:</b>
      org.hibernate.HibernateException: hibernate.conf.xml not found
        at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:147)
        at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1402)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1424)
    I have read all  forum topics about this, including:
    Where to put config files in webdynpro ?
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/bf0d57db-0c01-0010-6fa3-83503981eed4
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2ae0614a-0601-0010-a491-a9a635f06613
    Problem in placing hibernate.cfg.xml
    /people/bala.krishnan2/blog/2006/09/25/bid-adieu-to-bots--using-captchas
    /people/valery.silaev/blog/2005/09/14/a-bit-of-impractical-scripting-for-web-dynpro
    How to add external jar in web dynpro without going for DC
    Web Dynpro References
    Using External Library in Web Dynpro - Error
    Deploy external jar to WAS 6.40

    Hi Ivan,
    you need to make sure you place the configuration file where the application server's class loader will find it. If you are running Web Dynpros (or any other web application), you may put it under WEB-INF/classes of your web module.
    You may have J2EE applications without any web components - for example if you intend to only provide business logic for web services or rich clients. In this case you may not have any web modules, but will probably have some kind of EJB jars or such. The Hibernate POJOs are a more natural part of such jars rather then WARs (web modules). In this case you can put them under the root of this JAR. The class loader of the SAP J2EE Engine will load any property file placed in the class path of the class loader - whether it's a flat text file or an xml file. WEB-INF/classes or WEB-INF/lib is always in the class path of the (application) class loader.
    There is one thing you have to be aware of though. I do not know which version of Hibernate you are working with, but if you look at the source code of hibernate (the binaries are in the hibernate.jar) you will see that, the method Configuration.configure() without any argument will try to load the hibernate.cfg.xml from the current path - which means, the hibernate.jar and the hibernate.cfg.xml will have to reside under the same folder. But you do not seem to do this, so it is OK. This applies to versions of the NetWeaver 6.40 or 6.40s. Most likely this also applies to the new JEE 5 preview version of the NetWeaver application server also available for download on SDN, since to my knowledge the class loadign concepts have not been changed. But I have not tested this yet.
    Beyond the How-To-Guide about running Hibernate on NetWeaver (or SAP J2EE Engine) 6.40 we have also provided a sample application and its source code as IDE projects. Take a look at them and you will find the hibernate.cfg.xml file in the deployable EAR.
    I hope this answers your question and my comment has been helpful to you.
    Cheers, Goran

  • Why Coherence mandates to name the file as hibernate.cfg.xml ???

    Wondering Why Coherence mandates to name the file as hibernate.cfg.xml , otherwise it wouldn't work
    We use Spring 2.5, Hibernate 3.2, Coherence 3.5
    •     Currently we have created hibernate.cfg.xml to make coherence work whereas we would like to leverage existing spring configuration file
    •     We wrote separate DAO’s i.e. xxxCoherenceDAO in addition to exsisting DAO’s. We would like to inject NamedCache into **CoherenceDAO
    • How to leverage Spring to start the CacheFactory i.e. we would like to avoid the following code in our XXXCoherenceDAO's
    NameCache customerCache = CacheFactory.getCache(com.xx.Customer.class.getName());

    Take a look at the [JavaDoc for HibernateCacheLoader|http://download.oracle.com/otn_hosted_doc/coherence/352/com/tangosol/coherence/hibernate/HibernateCacheLoader.html]. It has several constructors that allow you to either provide the name of the Hibernate configuration or provide a SessionFactory created externally.
    Thanks,
    Patrick

  • Guys why is Coherence asking for hibernate.cfg.xml file ???

    Wondering why Coherence could not read/interpret from our hibernate mapping file and ask for hibernate.cfg.xml.
    Wondering if Coherence has been configured to require hibernate.cfg.xml.
    Here is the error i get while running JUnit test
    2009-11-10 11:01:31.302/42.589 Oracle Coherence GE 3.5.1/461p2 <Error> (thread=DistributedCache, member=1): BackingMapManager com.tangosol.net.DefaultConfigurableCacheFactory$Manager: failed to instantiate a cache: com.comcast.customer.contract.contract.hibernate.Contract
    2009-11-10 11:01:31.302/42.589 Oracle Coherence GE 3.5.1/461p2 <Error> (thread=DistributedCache, member=1):
    (Wrapped: Failed to instantiate class "com.tangosol.coherence.hibernate.HibernateCacheStore" using sun.misc.Launcher$AppClassLoader@1ab634
    <class-scheme>
      <class-name>com.tangosol.coherence.hibernate.HibernateCacheStore</class-name>
      <init-params>
        <init-param>
          <param-type>java.lang.String</param-type>
          <param-value>com.comcast.customer.contract.contract.hibernate.Contract</param-value>
        </init-param>
      </init-params>
    </class-scheme>) java.lang.reflect.InvocationTargetException
         at com.tangosol.util.Base.ensureRuntimeException(Base.java:293)
         at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2307)
         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateAny(DefaultConfigurableCacheFactory.java:2959)
         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateCacheStore(DefaultConfigurableCacheFactory.java:2822)
         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateReadWriteBackingMap(DefaultConfigurableCacheFactory.java:1458)
         at com.tangosol.net.DefaultConfigurableCacheFactory.configureBackingMap(DefaultConfigurableCacheFactory.java:1223)
         at com.tangosol.net.DefaultConfigurableCacheFactory$Manager.instantiateBackingMap(DefaultConfigurableCacheFactory.java:3457)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.instantiateResourceMap(DistributedCache.CDB:22)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.setCacheName(DistributedCache.CDB:27)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$ConfigListener.entryInserted(DistributedCache.CDB:15)
         at com.tangosol.util.MapEvent.dispatch(MapEvent.java:206)
         at com.tangosol.util.MapEvent.dispatch(MapEvent.java:166)
         at com.tangosol.util.MapListenerSupport.fireEvent(MapListenerSupport.java:556)
         at com.tangosol.util.ObservableHashMap.dispatchEvent(ObservableHashMap.java:229)
         at com.tangosol.util.ObservableHashMap$Entry.onAdd(ObservableHashMap.java:270)
         at com.tangosol.util.SafeHashMap.put(SafeHashMap.java:244)
         at com.tangosol.coherence.component.util.collections.WrapperMap.put(WrapperMap.CDB:1)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid$ServiceConfigMap.put(Grid.CDB:31)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$StorageIdRequest.onReceived(DistributedCache.CDB:45)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onMessage(Grid.CDB:9)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onNotify(Grid.CDB:136)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache.onNotify(DistributedCache.CDB:3)
         at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.reflect.InvocationTargetException
         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:494)
         at com.tangosol.util.ClassHelper.newInstance(ClassHelper.java:662)
         at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2297)
         ... 22 more
    Caused by: org.hibernate.HibernateException: /hibernate.cfg.xml not found
         at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:147)
         at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1405)
         at org.hibernate.cfg.Configuration.configure(Configuration.java:1427)
         at org.hibernate.cfg.Configuration.configure(Configuration.java:1414)
         at com.tangosol.coherence.hibernate.HibernateCacheLoader.<init>(HibernateCacheLoader.java:72)
         at com.tangosol.coherence.hibernate.HibernateCacheStore.<init>(HibernateCacheStore.java:48)
         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:494)
         at com.tangosol.util.ClassHelper.newInstance(ClassHelper.java:662)
         at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2297)
         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateAny(DefaultConfigurableCacheFactory.java:2959)
         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateCacheStore(DefaultConfigurableCacheFactory.java:2822)
         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateReadWriteBackingMap(DefaultConfigurableCacheFactory.java:1458)
         at com.tangosol.net.DefaultConfigurableCacheFactory.configureBackingMap(DefaultConfigurableCacheFactory.java:1223)
         at com.tangosol.net.DefaultConfigurableCacheFactory$Manager.instantiateBackingMap(DefaultConfigurableCacheFactory.java:3457)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.instantiateResourceMap(DistributedCache.CDB:22)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.setCacheName(DistributedCache.CDB:27)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$ConfigListener.entryInserted(DistributedCache.CDB:15)
         at com.tangosol.util.MapEvent.dispatch(MapEvent.java:206)
         at com.tangosol.util.MapEvent.dispatch(MapEvent.java:166)
         at com.tangosol.util.MapListenerSupport.fireEvent(MapListenerSupport.java:556)
         at com.tangosol.util.ObservableHashMap.dispatchEvent(ObservableHashMap.java:229)
         at com.tangosol.util.ObservableHashMap$Entry.onAdd(ObservableHashMap.java:270)
         at com.tangosol.util.SafeHashMap.put(SafeHashMap.java:244)
         at com.tangosol.coherence.component.util.collections.WrapperMap.put(WrapperMap.CDB:1)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid$ServiceConfigMap.put(Grid.CDB:31)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$StorageIdRequest.onReceived(DistributedCache.CDB:45)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onMessage(Grid.CDB:9)

    Hi Tom/Rob,
    Thanks for quick response. As suggested i have added another <init-param> so that HibernateCacheStore picks up my configuration file instead of hibernate.cfg.xml
    Here is the exception
    - Error parsing XML: application-context.xml(6) Document is invalid: no grammar found.
    - Error parsing XML: application-context.xml(6) Document root element "beans", must match DOCTYPE root "null".
    - configuring from resource: application-context.xml
    - Configuration resource: application-context.xml
    - Error parsing XML: application-context.xml(6) Document is invalid: no grammar found.
    - Error parsing XML: application-context.xml(6) Document root element "beans", must match DOCTYPE root "null".
    2009-11-10 13:38:39.254/45.068 Oracle Coherence GE 3.5.1/461p2 <Error> (thread=DistributedCache, member=1): BackingMapManager com.tangosol.net.DefaultConfigurableCacheFactory$Manager: failed to instantiate a cache: com.comcast.customer.contract.contract.hibernate.Contract
    2009-11-10 13:38:39.254/45.068 Oracle Coherence GE 3.5.1/461p2 <Error> (thread=DistributedCache, member=1):
    (Wrapped: Failed to instantiate class "com.tangosol.coherence.hibernate.HibernateCacheStore" using sun.misc.Launcher$AppClassLoader@18b634
    <class-scheme>
      <class-name>com.tangosol.coherence.hibernate.HibernateCacheStore</class-name>
      <init-params>
        <init-param>
          <param-type>java.lang.String</param-type>
          <param-value>com.comcast.customer.contract.contract.hibernate.Contract</param-value>
        </init-param>
        <init-param>
          <param-type>java.lang.String</param-type>
          <param-value>application-context.xml</param-value>
        </init-param>
      </init-params>
    </class-scheme>) java.lang.reflect.InvocationTargetException
         at com.tangosol.util.Base.ensureRuntimeException(Base.java:293)
         at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2307)
         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateAny(DefaultConfigurableCacheFactory.java:2959)
         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateCacheStore(DefaultConfigurableCacheFactory.java:2822)
         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateReadWriteBackingMap(DefaultConfigurableCacheFactory.java:1458)
         at com.tangosol.net.DefaultConfigurableCacheFactory.configureBackingMap(DefaultConfigurableCacheFactory.java:1223)
         at com.tangosol.net.DefaultConfigurableCacheFactory$Manager.instantiateBackingMap(DefaultConfigurableCacheFactory.java:3457)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.instantiateResourceMap(DistributedCache.CDB:22)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.setCacheName(DistributedCache.CDB:27)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$ConfigListener.entryInserted(DistributedCache.CDB:15)
         at com.tangosol.util.MapEvent.dispatch(MapEvent.java:206)
         at com.tangosol.util.MapEvent.dispatch(MapEvent.java:166)
         at com.tangosol.util.MapListenerSupport.fireEvent(MapListenerSupport.java:556)
         at com.tangosol.util.ObservableHashMap.dispatchEvent(ObservableHashMap.java:229)
         at com.tangosol.util.ObservableHashMap$Entry.onAdd(ObservableHashMap.java:270)
         at com.tangosol.util.SafeHashMap.put(SafeHashMap.java:244)
         at com.tangosol.coherence.component.util.collections.WrapperMap.put(WrapperMap.CDB:1)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid$ServiceConfigMap.put(Grid.CDB:31)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$StorageIdRequest.onReceived(DistributedCache.CDB:45)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onMessage(Grid.CDB:9)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onNotify(Grid.CDB:136)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache.onNotify(DistributedCache.CDB:3)
         at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.reflect.InvocationTargetException
         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:494)
         at com.tangosol.util.ClassHelper.newInstance(ClassHelper.java:662)
         at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2297)
         ... 22 more
    Caused by: org.hibernate.MappingException: invalid configuration
         at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1487)
         at org.hibernate.cfg.Configuration.configure(Configuration.java:1428)
         at com.tangosol.coherence.hibernate.HibernateCacheLoader.<init>(HibernateCacheLoader.java:94)
         at com.tangosol.coherence.hibernate.HibernateCacheStore.<init>(HibernateCacheStore.java:62)
         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:494)
         at com.tangosol.util.ClassHelper.newInstance(ClassHelper.java:662)
         at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2297)Please note the addition of
    <init-param>
          <param-type>java.lang.String</param-type>
          <param-value>application-context.xml</param-value>
        </init-param>application-context.xml - is for Spring application context
    META-INF/spring.xml - is for root hibernate configuration File .
    So in the above code snippet i tried replacing"application-context.xml " with "spring.xml" or "META-INF/spring.xml " or "classspath*:META-INF/spring.xml " anything results in the above exception

  • Where to place hibernate.cfg.xml in case of a Ear Project

    Hi
    i am trying to use Hibernate inside EJB 3.0 Bean
    When trying to access , EJB from my servlet , i am getting this Exception :
    javax.ejb.EJBException: EJB Exception: ; nested exception is:
    *     java.lang.NoClassDefFoundError: org/hibernate/Session; nested exception is: java.rmi.RemoteException: EJB Exception: ; nested exception is:*
    *     java.lang.NoClassDefFoundError: org/hibernate/Session*
    By reading previous forums i made some modifications , but still it is not working .
    Please tell me where exactly i should place hibernate.cfg.xml ??
    Whether inside the EJB Module or inside the Ear ??

    the hibernate.cfg.xml needs to be in the root of the classpath. This means that if it ends up in the root of your EJB jar, it should be found.

  • 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

  • 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>

  • XML Configuration or Annotations in Hibernate

    I have been kicking Hibernate around for a couple of days and would like y'alls 2 cents. A bean can have its metadata set up in a *.hbm.xml configuration file or the same can be done via annotations, what has worked best and what have been the disadvantages of each?
    I have used xml configuration in the past and having an xml file for each bean class got to be an annoyance once there were more then just a few beans to manage. With annotations the xml file would not be needed and the information would be in the bean class. I like this idea but since I have never used annotations extensively what issues have been encountered by y'all.

    There are issues are around transparency. The idea of a POJO was originally that the code wasn't coupled to a framework. Annotations effectively do couple you to the framework again, but you have to ask "is this actually a bad thing?". Unless you're in the habit of chopping and changing persistence frameworks, then it's not so bad. I had an issue recently whereby I was generating classes from XML schemas as part of the build process, and couldn't easily put Hibernate annotations onto the classes without a manual step. I did actually find a JAXB Maven plugin that did it, but I went with XML config for persistence anyway as it gave me some extra control that the generated code didn't, namely some properties were transient as regards persistence, but still necessary on the beans
    And there's the other reason you might not want to use annotations: when your DB schema changes, you have to recompile and re-deploy the code. How much of an issue that is, is entirely dependent upon your situation. It usually happens anyway

  • Annotated configuration vs XML configuration

    I have to decide whether to move ahead and use Annotations for an application for a major enhancement task.
    XML configurations can be replaced with annotations for the following items:
    1. Spring related (EJB configurations, bean configurations (layers of dependent java classes getting injected))
    2. Hibernate related (getting rid of HBM XMLs)
    But, developers are not that keen to move ahead with the annotation thing, since during development they will have to re-compile every time there is a minor configuration change.
    Now, what I can foresee is that when the application is in production, there will be few (maybe none) configuration changes. So the XML files stay unchanged anyways and beats the no-need-to-re-compile logic!
    And yes, Client wants to shift to the latest and greatest of Spring and Hibernate. So just giving them new third party jars packaged with the application without introducing the usage of the new features, seem to be irrelevant!
    So how do I balance both ends and decide, keeping the developers at ease during development phase? Will it be a good idea to migrate from XMLs to Annotations as a separate developmental activity once the business enhancements are taken care of?
    Sorry if I was not able to express myself clearly. Please do revert in that case as well.

    LearningCurve wrote:
    I have to decide whether to move ahead and use Annotations for an application for a major enhancement task.
    XML configurations can be replaced with annotations for the following items:
    1. Spring related (EJB configurations, bean configurations (layers of dependent java classes getting injected))
    2. Hibernate related (getting rid of HBM XMLs)
    But, developers are not that keen to move ahead with the annotation thing, since during development they will have to re-compile every time there is a minor configuration change.Sounds like idiocy to me.
    First when I work on my computer nothing gets changed, period, until I decide to change. Thus I don't need to 'rebuild' anything because of some other change until I decide it is appropriate.
    Second I commonly rebuild everything from scratch for every single build. I simply do not trust the dependency checking system. And it is isn't like I am running on a 286 with 640k of memory. Builds often run so fast that I sometimes need to rebuild several times because I looked away momentarily and when I looked back the build is finished and I am not sure I started it.
    Third, what sort of "minor" change will require a rebuild every time such that it isn't accompanied by code changes as well? It is a 'minor' change to add a new column to the database but if the developer is updating to the code that uses that then they should be updating the database as well, and I can't imagine that taking less time than a complete rebuild.
    Fourth sounds like a bunch of cowboy programmers that like to stick their fingers in everything. Certainly where I have worked someone (me) would be solely responsible for the database layer. I wouldn't be making a "minor" change that didn't have code and database impacts.
    And yes, Client wants to shift to the latest and greatest of Spring and Hibernate. So just giving them new third party jars packaged with the application without introducing the usage of the new features, seem to be irrelevant!
    That isn't a reason. With no other requirement than "let it be new" that isn't point in favor. If the client is going to be actively messing with the code of the system then someone better looking into understanding exactly what it is that the client expects to be delivered.

  • Persistence.XML configuration

    Hello,
    I develop web application and use it with following environment:
    Server: JBoss As 4.2.3.GA
    Technology: EJB 3.0
    Database : Oracle,SQLServer,MYSQL
    my problem is : when i deploy ear ,for some places i need to connect one type of database (Oracle for example), also for another places i need to connect to other databases and i have to change dialects for every database ,build it and then deploy.
    Is there any other way to build only once and connect to any of the databases without modifying persistence.xml for every time?

    Is the application accessing multiple databases at the same time? If so, you can define multiple persistence units in your persistence.xml.
    or is it that the application accesses only one database but you sometimes deploy it against different database types (perhaps a test environment vs a prod one). In that case you should look at supplying the hibernate and database configurations on the application server (details are application server specific). The persistence.xml would only contain the JNDI name of the datasource and then you only change the settings in datasource file on the server to point to different databases. Remember the dialect is actually optional as hibernate usually picks the right oneanyway.

  • How to generate an XML Configuration File for EBS Source Type

    Hi,
    We have installed SES, I want to integrate it to enable for searching repository contracts.
    In the sources I have selected oracle.apps.okc.repository.textsearch.server.RepHeaderSearchExpVO.
    For this source I need to specify the Configuration URL.
    Here I need to provide the path for configuration XML file. But before that I need to generate the XML Configuration file.
    Is there any steps on how we can create this XML file.
    like I would want to know how we can create the XML file and on which folder on the server should I be putting it
    Thanks

    Hi there,
    We are running into same issue and need the exact same information. Can someone help with this question on priority?
    Thanks,
    Darshan

Maybe you are looking for

  • A 'For' loop within another 'For' loop

    This is the loop: for (int i = 1; i<=5; i++) { for (int k = 1; k<=3; k++) { System.out.println("i is " + i + ", k is " + k); How does it execute? After it goes through the loop i = 1, and k = 1, apparently it then doesn't go to i = 2, but instead it

  • On Yosemite how do I get Pages to print the page number on every page, not just on alternate ones?

    I  only changed from Windows to an iMac earlier this year (now on Yosemite), but cannot get Pages to print the page number on every page;  it seems only to do it on alternate pages.

  • How to remain the screen data after poping up the message.?

    Hi Experts, Case: Whe User is creating a sales order, suppose in the screen he had given the sales organization, divison, channel etc. Now i have to modify the exit to validate some condition by taking all the data. For ex. loading date, divison etc.

  • Cisco ISE Date Format mm/dd/yyyy

    We have implemented Cisco ISE Guest Portal and when we create a new account for a visitor the date format is mm/dd/yyyy.See attached file. We have tried to change it through Administration/Settings/Language Template/English/Configure Time/Date Format

  • Web pages won't print since auto upgrade to 3.6.15

    As I stared up this morning Mozilla started an automatic upgrade to 3.6.15. Since the upgrade I cannot print directly from the web. I either have to copy the page over to word and print it there or copy it over to IE where I can still print.