Announcement Announcement Module
Collapse
No announcement yet.
Using configuration file in a jar library (Creating hibernate library) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using configuration file in a jar library (Creating hibernate library)

    Hi,

    I have a huge datebase and I am using it in several applications, So I thought it should be easier for me to create a jar file that contains all the classes, xml files and mappings into one jar file and to just import it when I need it. The problem is that the program doesn't recognise my mapping in the configuration file placed in the jar library .. it says:
    Unknown entity: NomadHibXml.TestNetwork
    and I think that's a problem regarding the configuration file, The library is working good, I tested it, The configuration file is read also in this program since there is no problem of connection .. but the mapping is not working
    Anyone can help? thanks.

  • #2
    I had the same problem the domain objects are scattered into multiple java projects, These projects intrun are part of an ear file. Since all the domain objects and mappings are in individual jar file when I start the application I got the same error as you described in your post.

    I resolved the problem by adding class definition of all domain objects into the persistence.xml file

    1. Poject A -- projecta.domain.One

    2. Project B -- projectb.domain.Two

    Code:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    
    <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_1_0.xsd"
    	version="1.0">
    
    <persistence-unit name="cwCareweb">
     <class>projecta.domain.One</class>
     <class>projectb.domain.Two</class>
    </persistence-unit>
    </persistence>

    Comment

    Working...
    X