-->
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: caching and schemaexport fails
PostPosted: Thu Dec 02, 2004 6:39 am 
Regular
Regular

Joined: Sun Aug 01, 2004 6:49 pm
Posts: 76
I have a problem with caching with following mapping and schemaexport:
net.sf.hibernate.MappingException: duplicate cache region

The application itself works well even with the new mapping and caching enabled (net.sf.ehcache.hibernate.Provider), but the schemaexport out of an ant task fails.

Hibernate version: 2.1.6

Mapping documents:

Code:
<?xml version="1.0"?>

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

<hibernate-mapping auto-import="false">
    <class
        name="com.itth.photodb.om.Adresse"
        table="Adresse"
        dynamic-update="false"
        dynamic-insert="false"
    >
        <cache usage="transactional" />

        <id
            name="id"
            column="id"
            type="java.lang.Integer"
        >
            <generator class="native">
                <param name="sequence">generator_adresse</param>
            </generator>
        </id>

        <version
            name="mtime"
            type="timestamp"
            column="mtime"
            access="property"
            unsaved-value="undefined"
        />

        <property
            name="x_koord"
            type="java.lang.Integer"
            update="true"
            insert="true"
            access="property"
            column="x_koord"
            not-null="false"
        />

        <property
            name="y_koord"
            type="java.lang.Integer"
            update="true"
            insert="true"
            access="property"
            column="y_koord"
            not-null="false"
        />

        <many-to-one
            name="postleitzahl"
            class="com.itth.photodb.om.Postleitzahl"
            cascade="save-update"
            outer-join="auto"
            update="true"
            insert="true"
            access="property"
        >
            <column
                name="id_postleitzahl"
            />
        </many-to-one>

        <many-to-one
            name="ort"
            class="com.itth.photodb.om.Ort"
            cascade="save-update"
            outer-join="auto"
            update="true"
            insert="true"
            access="property"
        >
            <column
                name="id_ort"
            />
        </many-to-one>

        <many-to-one
            name="strasse"
            class="com.itth.photodb.om.Strasse"
            cascade="save-update"
            outer-join="auto"
            update="true"
            insert="true"
            access="property"
        >
            <column
                name="id_strasse"
            />
        </many-to-one>

        <property
            name="hausnummer"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="hausnummer"
            not-null="false"
        />

        <property
            name="ctime"
            type="java.util.Date"
            update="true"
            insert="true"
            access="property"
            column="ctime"
        />

        <set
            name="dokumente"
            lazy="true"
            inverse="true"
            cascade="all-delete-orphan"
            sort="unsorted"
            order-by="ctime asc"
        >

              <key
                  column="id_adresse"
              >
              </key>

              <one-to-many
                  class="com.itth.photodb.om.Dokument"
              />
        </set>

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-Adresse.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>



Full stack trace of any exception that occurs:
Code:
[schemaexport] 04-12-02 11:16:42 ERROR net.sf.hibernate.cfg.Configuration:255 - Could not compile the mapping document
[schemaexport] net.sf.hibernate.MappingException: duplicate cache region
[schemaexport]  at net.sf.hibernate.cfg.Mappings.addCache(Mappings.java:198)
[schemaexport]  at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:353)
[schemaexport]  at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1256)
[schemaexport]  at net.sf.hibernate.cfg.Configuration.add(Configuration.java:252)
[schemaexport]  at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:174)
[schemaexport]  at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
[schemaexport]  at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
[schemaexport]  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[schemaexport]  at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaexport]  at org.apache.tools.ant.Target.execute(Target.java:301)
[schemaexport]  at org.apache.tools.ant.Target.performTasks(Target.java:328)
[schemaexport]  at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[schemaexport]  at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
[schemaexport]  at org.apache.tools.ant.Main.runBuild(Main.java:632)
[schemaexport]  at org.apache.tools.ant.Main.startAnt(Main.java:183)
[schemaexport]  at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
[schemaexport]  at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
[schemaexport] 04-12-02 11:16:42 ERROR net.sf.hibernate.cfg.Configuration:178 - Could not configure datastore from file: /home/th/projects/photodb/src/com/itth/photodb/om/Adresse.hbm.xml
[schemaexport] net.sf.hibernate.MappingException: duplicate cache region
[schemaexport]  at net.sf.hibernate.cfg.Mappings.addCache(Mappings.java:198)
[schemaexport]  at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:353)
[schemaexport]  at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1256)
[schemaexport]  at net.sf.hibernate.cfg.Configuration.add(Configuration.java:252)
[schemaexport]  at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:174)
[schemaexport]  at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
[schemaexport]  at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
[schemaexport]  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[schemaexport]  at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaexport]  at org.apache.tools.ant.Target.execute(Target.java:301)
[schemaexport]  at org.apache.tools.ant.Target.performTasks(Target.java:328)
[schemaexport]  at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[schemaexport]  at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
[schemaexport]  at org.apache.tools.ant.Main.runBuild(Main.java:632)
[schemaexport]  at org.apache.tools.ant.Main.startAnt(Main.java:183)
[schemaexport]  at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
[schemaexport]  at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)


Name and version of the database you are using: MySQL / Oracle 10g


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.