-->
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.  [ 2 posts ] 
Author Message
 Post subject: NullPointerException when executing SchemaExportTask
PostPosted: Tue Mar 08, 2005 6:12 pm 
Newbie

Joined: Tue Mar 08, 2005 6:04 pm
Posts: 4
Hi all,

I'm trying to generate the database schema using my mapping files. I keep getting the exception below.

One of my mapping files is as follows :
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>
<!--
    Created by the Middlegen Hibernate plugin 2.1

    http://boss.bekk.no/boss/middlegen/
    http://www.hibernate.org/
-->

<class
    name="be.milieuinfo.cbb.model.AdresBe"
    table="adres_be"
>
    <meta attribute="class-description" inherit="false">
       @hibernate.class
        table="adres_be"
    </meta>

    <id
        name="adrbeId"
        type="java.lang.Integer"
        column="adrbe_id"
    >
        <meta attribute="field-description">
           @hibernate.id
            generator-class="assigned"
            type="java.lang.Integer"
            column="adrbe_id"

        </meta>
        <generator class="assigned" />
    </id>

    <property
        name="datumCreatie"
        type="java.sql.Date"
        column="datum_creatie"
        not-null="true"
        length="4"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="datum_creatie"
            length="4"
            not-null="true"
        </meta>   
    </property>
    <property
        name="userCreatie"
        type="java.lang.String"
        column="user_creatie"
        not-null="true"
        length="50"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="user_creatie"
            length="50"
            not-null="true"
        </meta>   
    </property>
    <property
        name="datumAanpassing"
        type="java.sql.Date"
        column="datum_aanpassing"
        length="4"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="datum_aanpassing"
            length="4"
        </meta>   
    </property>
    <property
        name="userAanpassing"
        type="java.lang.String"
        column="user_aanpassing"
        length="50"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="user_aanpassing"
            length="50"
        </meta>   
    </property>
    <property
        name="updatecount"
        type="int"
        column="updatecount"
        not-null="true"
        length="4"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="updatecount"
            length="4"
            not-null="true"
        </meta>   
    </property>

    <!-- Associations -->
     
    <!-- bi-directional one-to-many association to AdresBeHist -->
    <set
        name="adresBeHists"
        lazy="false"
        inverse="true"
      cascade="none"
    >
        <meta attribute="field-description">
           @hibernate.set
            lazy="false"
            inverse="true"
            cascade="none"

           @hibernate.collection-key
            column="adrbe_id"

           @hibernate.collection-one-to-many
            class="be.milieuinfo.cbb.model.AdresBeHist"
        </meta>
        <key>
            <column name="adrbe_id" />
        </key>
        <one-to-many
            class="be.milieuinfo.cbb.model.AdresBeHist"
        />
    </set>
    <!-- bi-directional one-to-many association to AdresPerceel -->
    <set
        name="adresPerceels"
        lazy="false"
        inverse="true"
      cascade="none"
    >
        <meta attribute="field-description">
           @hibernate.set
            lazy="false"
            inverse="true"
            cascade="none"

           @hibernate.collection-key
            column="adrbe_id"

           @hibernate.collection-one-to-many
            class="be.milieuinfo.cbb.model.AdresPerceel"
        </meta>
        <key>
            <column name="adrbe_id" />
        </key>
        <one-to-many
            class="be.milieuinfo.cbb.model.AdresPerceel"
        />
    </set>
    <!-- bi-directional one-to-many association to ExploitantAdre -->
    <set
        name="exploitantAdres"
        lazy="false"
        inverse="true"
      cascade="none"
    >
        <meta attribute="field-description">
           @hibernate.set
            lazy="false"
            inverse="true"
            cascade="none"

           @hibernate.collection-key
            column="adrbe_id"

           @hibernate.collection-one-to-many
            class="be.milieuinfo.cbb.model.ExploitantAdre"
        </meta>
        <key>
            <column name="adrbe_id" />
        </key>
        <one-to-many
            class="be.milieuinfo.cbb.model.ExploitantAdre"
        />
    </set>
    <!-- bi-directional one-to-many association to Exploitatie -->
    <set
        name="exploitaties"
        lazy="false"
        inverse="true"
      cascade="none"
    >
        <meta attribute="field-description">
           @hibernate.set
            lazy="false"
            inverse="true"
            cascade="none"

           @hibernate.collection-key
            column="adrbe_id"

           @hibernate.collection-one-to-many
            class="be.milieuinfo.cbb.model.Exploitatie"
        </meta>
        <key>
            <column name="adrbe_id" />
        </key>
        <one-to-many
            class="be.milieuinfo.cbb.model.Exploitatie"
        />
    </set>

</class>
</hibernate-mapping>


Does anybody have an idea of what could be going wrong here?

Thanks in advance for helping me out.

Johan,

Hibernate version: 2.1.6

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
Code:
[schemaexport] java.lang.NullPointerException
[schemaexport]  at net.sf.hibernate.util.StringHelper.qualify(StringHelper.java:239)
[schemaexport]  at net.sf.hibernate.cfg.Binder.bindComponent(Binder.java:734)
[schemaexport]  at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:257)
[schemaexport]  at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1173)
[schemaexport]  at net.sf.hibernate.cfg.Configuration.add(Configuration.java:245)
[schemaexport]  at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:167)
[schemaexport]  at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.
java:185)
[schemaexport]  at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:131)

[schemaexport]  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[schemaexport]  at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaexport]  at org.apache.tools.ant.Target.execute(Target.java:341)
[schemaexport]  at org.apache.tools.ant.Target.performTasks(Target.java:369)
[schemaexport]  at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[schemaexport]  at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[schemaexport]  at org.apache.tools.ant.Main.runBuild(Main.java:673)
[schemaexport]  at org.apache.tools.ant.Main.startAnt(Main.java:188)
[schemaexport]  at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
[schemaexport]  at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)


Name and version of the database you are using:Informix, also tried on MySQL.


Top
 Profile  
 
 Post subject: Re: NullPointerException when executing SchemaExportTask
PostPosted: Wed Jan 25, 2006 2:53 pm 
Newbie

Joined: Wed Jan 25, 2006 2:42 pm
Posts: 1
Location: California
Don't know if this is applicable to version 2.0, but in version 3.1, I solved the problem by using the HibernateToolTask instead of the SchemaExportTask. Here's an explanation:

http://www.digital-seven.net/?option=co ... view&id=71

Johan Kumps wrote:
Hi all,

I'm trying to generate the database schema using my mapping files. I keep getting the exception below.

One of my mapping files is as follows :
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>
<!--
    Created by the Middlegen Hibernate plugin 2.1

    http://boss.bekk.no/boss/middlegen/
    http://www.hibernate.org/
-->

<class
    name="be.milieuinfo.cbb.model.AdresBe"
    table="adres_be"
>
    <meta attribute="class-description" inherit="false">
       @hibernate.class
        table="adres_be"
    </meta>

    <id
        name="adrbeId"
        type="java.lang.Integer"
        column="adrbe_id"
    >
        <meta attribute="field-description">
           @hibernate.id
            generator-class="assigned"
            type="java.lang.Integer"
            column="adrbe_id"

        </meta>
        <generator class="assigned" />
    </id>

    <property
        name="datumCreatie"
        type="java.sql.Date"
        column="datum_creatie"
        not-null="true"
        length="4"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="datum_creatie"
            length="4"
            not-null="true"
        </meta>   
    </property>
    <property
        name="userCreatie"
        type="java.lang.String"
        column="user_creatie"
        not-null="true"
        length="50"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="user_creatie"
            length="50"
            not-null="true"
        </meta>   
    </property>
    <property
        name="datumAanpassing"
        type="java.sql.Date"
        column="datum_aanpassing"
        length="4"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="datum_aanpassing"
            length="4"
        </meta>   
    </property>
    <property
        name="userAanpassing"
        type="java.lang.String"
        column="user_aanpassing"
        length="50"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="user_aanpassing"
            length="50"
        </meta>   
    </property>
    <property
        name="updatecount"
        type="int"
        column="updatecount"
        not-null="true"
        length="4"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="updatecount"
            length="4"
            not-null="true"
        </meta>   
    </property>

    <!-- Associations -->
     
    <!-- bi-directional one-to-many association to AdresBeHist -->
    <set
        name="adresBeHists"
        lazy="false"
        inverse="true"
      cascade="none"
    >
        <meta attribute="field-description">
           @hibernate.set
            lazy="false"
            inverse="true"
            cascade="none"

           @hibernate.collection-key
            column="adrbe_id"

           @hibernate.collection-one-to-many
            class="be.milieuinfo.cbb.model.AdresBeHist"
        </meta>
        <key>
            <column name="adrbe_id" />
        </key>
        <one-to-many
            class="be.milieuinfo.cbb.model.AdresBeHist"
        />
    </set>
    <!-- bi-directional one-to-many association to AdresPerceel -->
    <set
        name="adresPerceels"
        lazy="false"
        inverse="true"
      cascade="none"
    >
        <meta attribute="field-description">
           @hibernate.set
            lazy="false"
            inverse="true"
            cascade="none"

           @hibernate.collection-key
            column="adrbe_id"

           @hibernate.collection-one-to-many
            class="be.milieuinfo.cbb.model.AdresPerceel"
        </meta>
        <key>
            <column name="adrbe_id" />
        </key>
        <one-to-many
            class="be.milieuinfo.cbb.model.AdresPerceel"
        />
    </set>
    <!-- bi-directional one-to-many association to ExploitantAdre -->
    <set
        name="exploitantAdres"
        lazy="false"
        inverse="true"
      cascade="none"
    >
        <meta attribute="field-description">
           @hibernate.set
            lazy="false"
            inverse="true"
            cascade="none"

           @hibernate.collection-key
            column="adrbe_id"

           @hibernate.collection-one-to-many
            class="be.milieuinfo.cbb.model.ExploitantAdre"
        </meta>
        <key>
            <column name="adrbe_id" />
        </key>
        <one-to-many
            class="be.milieuinfo.cbb.model.ExploitantAdre"
        />
    </set>
    <!-- bi-directional one-to-many association to Exploitatie -->
    <set
        name="exploitaties"
        lazy="false"
        inverse="true"
      cascade="none"
    >
        <meta attribute="field-description">
           @hibernate.set
            lazy="false"
            inverse="true"
            cascade="none"

           @hibernate.collection-key
            column="adrbe_id"

           @hibernate.collection-one-to-many
            class="be.milieuinfo.cbb.model.Exploitatie"
        </meta>
        <key>
            <column name="adrbe_id" />
        </key>
        <one-to-many
            class="be.milieuinfo.cbb.model.Exploitatie"
        />
    </set>

</class>
</hibernate-mapping>


Does anybody have an idea of what could be going wrong here?

Thanks in advance for helping me out.

Johan,

Hibernate version: 2.1.6

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
Code:
[schemaexport] java.lang.NullPointerException
[schemaexport]  at net.sf.hibernate.util.StringHelper.qualify(StringHelper.java:239)
[schemaexport]  at net.sf.hibernate.cfg.Binder.bindComponent(Binder.java:734)
[schemaexport]  at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:257)
[schemaexport]  at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1173)
[schemaexport]  at net.sf.hibernate.cfg.Configuration.add(Configuration.java:245)
[schemaexport]  at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:167)
[schemaexport]  at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.
java:185)
[schemaexport]  at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:131)

[schemaexport]  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[schemaexport]  at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaexport]  at org.apache.tools.ant.Target.execute(Target.java:341)
[schemaexport]  at org.apache.tools.ant.Target.performTasks(Target.java:369)
[schemaexport]  at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[schemaexport]  at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[schemaexport]  at org.apache.tools.ant.Main.runBuild(Main.java:673)
[schemaexport]  at org.apache.tools.ant.Main.startAnt(Main.java:188)
[schemaexport]  at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
[schemaexport]  at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)


Name and version of the database you are using:Informix, also tried on MySQL.

_________________
http://www.digital-seven.net


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

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.