-->
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: Problem with Custom Mapping Type being recognized
PostPosted: Wed Nov 10, 2004 1:31 pm 
Regular
Regular

Joined: Wed Dec 17, 2003 1:58 pm
Posts: 102
Hi I'm having a hard time getting schemaexport to work correctly with a custom user type. I'm executing schemaexport from a maven task. Here is the maven code, then whats happening is below, but basically its failing to find intrepret the user type. Help appreciated! Thanks!

-Maven Code
Code:
  <goal name="schemaExportMySQL">
    <attainGoal name="java:compile"/>
    <attainGoal name="java:jar-resources"/>
    <ant:taskdef name="schemaexport" classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask">
      <ant:classpath>
        <ant:path refid="maven.dependency.classpath"/>
        <ant:pathelement location="${maven.build.dest}"/>
      </ant:classpath>
    </ant:taskdef>
    <mkdir dir="${basedir}/target/schema/"/>
    <ant:echo>Exporting MySQL Schema File to: ${basedir}/target/schema/MySQL-schema.sql</ant:echo>
    <ant:schemaexport
      properties="${basedir}/src/resources/hibernate/mysql.properties"
      quiet="yes"
      text="yes"
      drop="no"
      delimiter=";"
      output="${basedir}/target/schema/MySQL-schema.sql">
      <ant:fileset dir="${maven.build.dest}">
        <ant:include name="**/*.hbm.xml"/>
      </ant:fileset>
    </ant:schemaexport>
  </goal>


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>
    <class
        name="com.dailydose.content.management.model.FileData"
        table="FILEDATA"
        dynamic-update="false"
        dynamic-insert="false"
        select-before-update="false"
    >

        <id
            name="id"
            column="ID"
            type="java.lang.Long"
            unsaved-value="null"
        >
            <generator class="identity">
              <!-- 
                  To add non XDoclet generator parameters, create a file named
                  hibernate-generator-params-FileData.xml
                  containing the additional parameters and place it in your merge dir.
              -->
            </generator>
        </id>

        <property
            name="data"
            type="com.dailydose.content.management.hibernate.BinaryBlobType"
            update="true"
            insert="true"
            access="property"
        >
            <column
                name="DATA"
                sql-type="longblob"
            />
        </property>

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

    </class>

</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
NA
Full stack trace of any exception that occurs:
Code:
xdoclet:hibernatedoclet:

    [echo] Compiling to C:\projects\dailydose/target/classes
    [javac] Compiling 1 source file to C:\projects\dailydose\target\classes

java:jar-resources:
    [echo] C:\projects\dailydose/target/classes
    [copy] Copying 1 file to C:\projects\dailydose\target\classes

    [echo] Exporting MySQL Schema File to: C:\projects\dailydose/target/schema/MySQL-schema.sql
Could not compile the mapping document
net.sf.hibernate.MappingException: Could not interpret type: com.dailydose.content.management.hibernate.BinaryBlobType
   at net.sf.hibernate.cfg.Binder.getTypeFromXML(Binder.java:934)
   at net.sf.hibernate.cfg.Binder.bindSimpleValue(Binder.java:435)
   at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1047)
   at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:362)
   at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1256)
   at net.sf.hibernate.cfg.Configuration.add(Configuration.java:252)
   at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:174)
   at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
   at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
   at org.apache.tools.ant.Task.perform(Task.java:341)
   at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:232)
   at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
   at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
   at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
   at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
   at com.werken.werkz.Goal.fire(Goal.java:639)
   at com.werken.werkz.Goal.attain(Goal.java:575)
   at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
   at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:634)
   at org.apache.maven.MavenSession.attainGoals(MavenSession.java:266)
   at org.apache.maven.cli.App.doMain(App.java:486)
   at org.apache.maven.cli.App.main(App.java:1215)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at com.werken.forehead.Forehead.run(Forehead.java:551)
   at com.werken.forehead.Forehead.main(Forehead.java:581)
Could not configure datastore from file: C:\projects\dailydose\target\classes\com\dailydose\content\management\model\FileData.hbm.xml
net.sf.hibernate.MappingException: Could not interpret type: com.dailydose.content.management.hibernate.BinaryBlobType
   at net.sf.hibernate.cfg.Binder.getTypeFromXML(Binder.java:934)
   at net.sf.hibernate.cfg.Binder.bindSimpleValue(Binder.java:435)
   at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1047)
   at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:362)
   at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1256)
   at net.sf.hibernate.cfg.Configuration.add(Configuration.java:252)
   at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:174)
   at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
   at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
   at org.apache.tools.ant.Task.perform(Task.java:341)
   at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:232)
   at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
   at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
   at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
   at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
   at com.werken.werkz.Goal.fire(Goal.java:639)
   at com.werken.werkz.Goal.attain(Goal.java:575)
   at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
   at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:634)
   at org.apache.maven.MavenSession.attainGoals(MavenSession.java:266)
   at org.apache.maven.cli.App.doMain(App.java:486)
   at org.apache.maven.cli.App.main(App.java:1215)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at com.werken.forehead.Forehead.run(Forehead.java:551)
   at com.werken.forehead.Forehead.main(Forehead.java:581)

BUILD FAILED
File...... C:\projects\dailydose\maven.xml
Element... ant:schemaexport
Line...... 57
Column.... 58
Schema text failed: net.sf.hibernate.MappingException: Could not interpret type: com.dailydose.content.management.hibernate.BinaryBlobType
Total time: 9 seconds
Finished at: Wed Nov 10 10:26:07 MST 2004


Name and version of the database you are using:
MySQL 4.1.x

The generated SQL (show_sql=true):
Can't get this to happen!

Debug level Hibernate log excerpt:
see above.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 10, 2004 1:41 pm 
Regular
Regular

Joined: Wed Dec 17, 2003 1:58 pm
Posts: 102
Don't ya hate it when you spend a long time on a problem, decide to ask for help then 2 minutes after doing so you found the problem? Sigh. Anyway I forgot to implement the interface on the custom type.

Thanks =)


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.