-->
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: Schemaupdate doesn't like timestamp attribute
PostPosted: Fri Dec 02, 2005 1:52 pm 
Newbie

Joined: Mon Nov 21, 2005 1:48 pm
Posts: 17
For some reason, schemaupdate doesn't seem to like the "timestamp" attribute in the xbm.xml file. What am I doing wrong?

Hibernate version: 3.1

Mapping documents:
Code:
<?xml version="1.0" encoding="UTF-8"?>

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

<hibernate-mapping
>
    <class
        name="wintox.audit.user.UserLoginAudit"
        table="myapp_userloginaudit"
    >

        <id
            name="id"
            column="id"
            type="long"
            unsaved-value="-1"
        >
            <generator class="native">
              <!-- 
                  To add non XDoclet generator parameters, create a file named
                  hibernate-generator-params-UserLoginAudit.xml
                  containing the additional parameters and place it in your merge dir.
              -->
            </generator>
        </id>

            <property
                name="username"
                type="java.lang.String"
                    update="true"
                    insert="true"
            column="username"
            length="25"
        />

            <property
                name="workstationId"
                type="java.lang.String"
                    update="true"
                    insert="true"
            column="workstationId"
            length="254"
        />

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

            <property
                name="isSuccessful"
                type="java.lang.Boolean"
                    update="true"
                    insert="true"
            column="isSuccessful"
        />

            <timestamp name="timestamp" column="timestamp"/>

    </class>

</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
N/A

Full stack trace of any exception that occurs:
Code:
[schemaupdate] org.hibernate.MappingException: invalid mapping
[schemaupdate]    at org.hibernate.cfg.Configuration.addFile(Configuration.java:227)
[schemaupdate]    at org.hibernate.tool.hbm2ddl.SchemaUpdateTask.getConfiguration(SchemaUpdateTask.java:155)
[schemaupdate]    at org.hibernate.tool.hbm2ddl.SchemaUpdateTask.execute(SchemaUpdateTask.java:102)
[schemaupdate]    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[schemaupdate]    at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaupdate]    at org.apache.tools.ant.Target.execute(Target.java:341)
[schemaupdate]    at org.apache.tools.ant.Target.performTasks(Target.java:369)
[schemaupdate]    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
[schemaupdate]    at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
[schemaupdate]    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
[schemaupdate]    at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[schemaupdate]    at org.apache.tools.ant.Main.runBuild(Main.java:668)
[schemaupdate]    at org.apache.tools.ant.Main.startAnt(Main.java:187)
[schemaupdate]    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
[schemaupdate]    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
[schemaupdate] Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,(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|query-list)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*)".
[schemaupdate]    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
[schemaupdate]    at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
[schemaupdate]    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
[schemaupdate]    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
[schemaupdate]    at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
[schemaupdate]    at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
[schemaupdate]    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
[schemaupdate]    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
[schemaupdate]    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
[schemaupdate]    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
[schemaupdate]    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
[schemaupdate]    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
[schemaupdate]    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
[schemaupdate]    at org.dom4j.io.SAXReader.read(SAXReader.java:465)
[schemaupdate]    at org.dom4j.io.SAXReader.read(SAXReader.java:264)
[schemaupdate]    at org.hibernate.cfg.Configuration.addFile(Configuration.java:226)
[schemaupdate]    ... 14 more


Name and version of the database you are using:
SQL Server 2000 SP4

The generated SQL (show_sql=true):
N/A

Debug level Hibernate log excerpt:
N/A


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 02, 2005 8:28 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Read the DTD. timestamp must come before all property mappings. The error message is pretty helpful in this case!


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.