Hi,
I am using the <meta> tag to generate some code. The attributes "class-code"
and "extra-attribute" seem to be ignored. In addition to this when these tags
are placed just before the end of the </class> tag, the XML parser breaks.
I did not find any unit tests in the source code that I could use as examples
so I may have some configuration/mapping error.
Please note that although this issue has already been brought up before, all posts
seem to use the DTD version 2 and I am using version 3 as is provided in the
CVS repository.
TIA,
Hugo Ferreira.
Hibernate version:
Hibernate 3.0 CVS
HibernateExt 3.0 CVS
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping
package="pt">
<class
name="Child"
table="browser.actor"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
where="g1='R' AND g2='W'"
>
<meta attribute="class-description">
Class generated via hbm2java.
Meta generated session aware
constructor is included.
@author hbm2java
</meta>
<meta attribute="extra-import">uy.Session</meta>
<meta attribute="class-code">
<![CDATA[
public Child(Session s) {
s.doX();
}
]]>
</meta>
<id
name="id"
column="idactor"
type="long"
>
<generator class="sequence">
<param name="sequence">idactor_seq</param>
</generator>
</id>
<property
name="name"
type="string"
update="true"
insert="true"
access="property"
column="nameac"
/>
<property
name="email"
type="string"
update="true"
insert="true"
access="property"
column="email"
/>
<property
name="address"
type="string"
update="true"
insert="true"
access="property"
column="address"
/>
<many-to-one
name="accommodationType"
class="Parent"
cascade="save-update"
outer-join="auto"
update="true"
insert="true"
access="property"
column="typela"
not-null="true"
/>
</class>
Configuration documents:
</hibernate-mapping>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="linkall">
<!-- properties -->
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="show_sql">true</property>
<property name="use_outer_join">true</property>
<property name="connection.username">hugof</property>
<property name="connection.driver_class">org.postgresql.jdbc2.optional.PoolingDataSource</property>
<property name="connection.url">jdbc:postgresql://localhost/browser</property>
<!-- mapping files -->
<mapping resource="pt/Child.hbm.xml"/>
<mapping resource="pt/Parent.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Code between sessionFactory.openSession() and session.close():
None
Full stack trace of any exception that occurs:
None
Name and version of the database you are using:
PostgreSQL 7.4
The generated SQL (show_sql=true):
None
Debug level Hibernate log excerpt:
Buildfile: /home/hugof/workspace/hiber3/build.xml
generatesources:
[hibernatetool] Executing org.hibernate.tool.ant.Hbm2JavaGeneratorTask@e2cb55
[hibernatetool] 16 Mar 2005 09:40:27.000 [INFO] [main] [org.hibernate.cfg.Environment] - Hibernate 3.0rc1
[hibernatetool] 16 Mar 2005 09:40:27.004 [INFO] [main] [org.hibernate.cfg.Environment] - hibernate.properties not found
[hibernatetool] 16 Mar 2005 09:40:27.020 [INFO] [main] [org.hibernate.cfg.Environment] - using CGLIB reflection optimizer
[hibernatetool] 16 Mar 2005 09:40:27.024 [INFO] [main] [org.hibernate.cfg.Environment] - using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] 16 Mar 2005 09:40:27.039 [INFO] [main] [org.hibernate.cfg.Configuration] - Mapping file: /home/hugof/workspace/hiber3/src/pt/Child.hbm.xml
[hibernatetool] 16 Mar 2005 09:40:27.151 [DEBUG] [main] [org.hibernate.util.DTDEntityResolver] - trying to locate
http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath under org/hibernate/
[hibernatetool] 16 Mar 2005 09:40:27.153 [DEBUG] [main] [org.hibernate.util.DTDEntityResolver] - found
http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath
[hibernatetool] 16 Mar 2005 09:40:27.420 [INFO] [main] [org.hibernate.cfg.HbmBinder] - Mapping class: pt.Child -> browser.actor
[hibernatetool] 16 Mar 2005 09:40:27.435 [DEBUG] [main] [org.hibernate.cfg.HbmBinder] - Mapped property: id -> idactor
[hibernatetool] 16 Mar 2005 09:40:27.466 [DEBUG] [main] [org.hibernate.cfg.HbmBinder] - Mapped property: name -> nameac
[hibernatetool] 16 Mar 2005 09:40:27.472 [DEBUG] [main] [org.hibernate.cfg.HbmBinder] - Mapped property: email -> email
[hibernatetool] 16 Mar 2005 09:40:27.473 [DEBUG] [main] [org.hibernate.cfg.HbmBinder] - Mapped property: address -> address
[hibernatetool] 16 Mar 2005 09:40:27.641 [DEBUG] [main] [org.hibernate.cfg.HbmBinder] - Mapped property: accommodationType -> typela
[hibernatetool] 16 Mar 2005 09:40:27.645 [INFO] [main] [org.hibernate.cfg.Configuration] - Mapping file: /home/hugof/workspace/hiber3/src/pt/Parent.hbm.xml
[hibernatetool] 16 Mar 2005 09:40:27.652 [DEBUG] [main] [org.hibernate.util.DTDEntityResolver] - trying to locate
http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath under org/hibernate/
[hibernatetool] 16 Mar 2005 09:40:27.655 [DEBUG] [main] [org.hibernate.util.DTDEntityResolver] - found
http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath
[hibernatetool] 16 Mar 2005 09:40:27.679 [INFO] [main] [org.hibernate.cfg.HbmBinder] - Mapping class: pt.Parent -> browser.typelocalactor
[hibernatetool] 16 Mar 2005 09:40:27.683 [DEBUG] [main] [org.hibernate.cfg.HbmBinder] - Mapped property: id -> idtla
[hibernatetool] 16 Mar 2005 09:40:27.686 [DEBUG] [main] [org.hibernate.cfg.HbmBinder] - Mapped property: name -> nametla
[hibernatetool] 16 Mar 2005 09:40:27.689 [DEBUG] [main] [org.hibernate.cfg.HbmBinder] - Mapped property: description -> desctla
[hibernatetool] 16 Mar 2005 09:40:27.696 [DEBUG] [main] [org.hibernate.cfg.HbmBinder] - Mapped property: children
[hibernatetool] 16 Mar 2005 09:40:27.851 [DEBUG] [main] [org.hibernate.tool.hbm2x.template] - CommonsLogLogSystem name is 'org.hibernate.tool.hbm2x.template'
[hibernatetool] 16 Mar 2005 09:40:27.852 [INFO] [main] [org.hibernate.tool.hbm2x.template] - **************************************************************
[hibernatetool] 16 Mar 2005 09:40:27.854 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Starting Jakarta Velocity v1.4
[hibernatetool] 16 Mar 2005 09:40:27.855 [INFO] [main] [org.hibernate.tool.hbm2x.template] - RuntimeInstance initializing.
[hibernatetool] 16 Mar 2005 09:40:27.856 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Default Properties File: org/apache/velocity/runtime/defaults/velocity.properties
[hibernatetool] 16 Mar 2005 09:40:27.859 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Trying to use logger class org.apache.velocity.tools.generic.log.CommonsLogLogSystem
[hibernatetool] 16 Mar 2005 09:40:27.860 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Using logger class org.apache.velocity.tools.generic.log.CommonsLogLogSystem
[hibernatetool] 16 Mar 2005 09:40:27.869 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
[hibernatetool] 16 Mar 2005 09:40:27.877 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Resource Loader Instantiated: org.apache.velocity.runtime.resource.loader.FileResourceLoader
[hibernatetool] 16 Mar 2005 09:40:27.878 [INFO] [main] [org.hibernate.tool.hbm2x.template] - FileResourceLoader : initialization starting.
[hibernatetool] 16 Mar 2005 09:40:27.880 [INFO] [main] [org.hibernate.tool.hbm2x.template] - FileResourceLoader : adding path '.'
[hibernatetool] 16 Mar 2005 09:40:27.882 [INFO] [main] [org.hibernate.tool.hbm2x.template] - FileResourceLoader : initialization complete.
[hibernatetool] 16 Mar 2005 09:40:27.883 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Resource Loader Instantiated: org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] 16 Mar 2005 09:40:27.885 [INFO] [main] [org.hibernate.tool.hbm2x.template] - ClasspathResourceLoader : initialization starting.
[hibernatetool] 16 Mar 2005 09:40:27.886 [INFO] [main] [org.hibernate.tool.hbm2x.template] - ClasspathResourceLoader : initialization complete.
[hibernatetool] 16 Mar 2005 09:40:27.898 [INFO] [main] [org.hibernate.tool.hbm2x.template] - ResourceCache : initialized. (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
[hibernatetool] 16 Mar 2005 09:40:27.901 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Default ResourceManager initialization complete.
[hibernatetool] 16 Mar 2005 09:40:27.906 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Loaded System Directive: org.apache.velocity.runtime.directive.Literal
[hibernatetool] 16 Mar 2005 09:40:27.912 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Loaded System Directive: org.apache.velocity.runtime.directive.Macro
[hibernatetool] 16 Mar 2005 09:40:27.919 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Loaded System Directive: org.apache.velocity.runtime.directive.Parse
[hibernatetool] 16 Mar 2005 09:40:27.928 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Loaded System Directive: org.apache.velocity.runtime.directive.Include
[hibernatetool] 16 Mar 2005 09:40:27.932 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
[hibernatetool] 16 Mar 2005 09:40:28.289 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Created: 20 parsers.
[hibernatetool] 16 Mar 2005 09:40:28.310 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Velocimacro : initialization starting.
[hibernatetool] 16 Mar 2005 09:40:28.312 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Velocimacro : adding VMs from VM library template : VM_global_library.vm
[hibernatetool] 16 Mar 2005 09:40:28.325 [ERROR] [main] [org.hibernate.tool.hbm2x.template] - ResourceManager : unable to find resource 'VM_global_library.vm' in any resource loader.
[hibernatetool] 16 Mar 2005 09:40:28.327 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Velocimacro : error using VM library template VM_global_library.vm : org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'VM_global_library.vm'
[hibernatetool] 16 Mar 2005 09:40:28.328 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Velocimacro : VM library template macro registration complete.
[hibernatetool] 16 Mar 2005 09:40:28.330 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Velocimacro : allowInline = true : VMs can be defined inline in templates
[hibernatetool] 16 Mar 2005 09:40:28.331 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
[hibernatetool] 16 Mar 2005 09:40:28.332 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
[hibernatetool] 16 Mar 2005 09:40:28.335 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Velocimacro : messages on : VM system will output logging messages
[hibernatetool] 16 Mar 2005 09:40:28.336 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Velocimacro : autoload off : VM system will not automatically reload global library macros
[hibernatetool] 16 Mar 2005 09:40:28.338 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Velocimacro : initialization complete.
[hibernatetool] 16 Mar 2005 09:40:28.341 [INFO] [main] [org.hibernate.tool.hbm2x.template] - Velocity successfully started.
[hibernatetool] 16 Mar 2005 09:40:28.520 [INFO] [main] [org.hibernate.tool.hbm2x.template] - ResourceManager : found pojo/javaclass.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] 16 Mar 2005 09:40:28.548 [WARN] [main] [org.hibernate.tool.hbm2x.template] - Warning! The iterative is an Iterator in the #foreach() loop at [0,0] in template pojo/javaclass.vm. Because it's not resetable, if used in more than once, this may lead to unexpected results.
[hibernatetool] 16 Mar 2005 09:40:28.590 [WARN] [main] [org.hibernate.tool.hbm2x.template] - Warning! The iterative is an Iterator in the #foreach() loop at [0,0] in template pojo/javaclass.vm. Because it's not resetable, if used in more than once, this may lead to unexpected results.
[hibernatetool] 16 Mar 2005 09:40:28.595 [INFO] [main] [org.hibernate.tool.hbm2x.POJOExporter] - Writing pt.Child to /home/hugof/workspace/hiber3/src/pt/Child.java
[hibernatetool] 16 Mar 2005 09:40:28.668 [INFO] [main] [org.hibernate.tool.hbm2x.template] - ResourceManager : found pojo/javaclass.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] 16 Mar 2005 09:40:28.671 [WARN] [main] [org.hibernate.tool.hbm2x.template] - Warning! The iterative is an Iterator in the #foreach() loop at [0,0] in template pojo/javaclass.vm. Because it's not resetable, if used in more than once, this may lead to unexpected results.
[hibernatetool] 16 Mar 2005 09:40:28.713 [WARN] [main] [org.hibernate.tool.hbm2x.template] - Warning! The iterative is an Iterator in the #foreach() loop at [0,0] in template pojo/javaclass.vm. Because it's not resetable, if used in more than once, this may lead to unexpected results.
[hibernatetool] 16 Mar 2005 09:40:28.717 [INFO] [main] [org.hibernate.tool.hbm2x.POJOExporter] - Writing pt.Parent to /home/hugof/workspace/hiber3/src/pt/Parent.java
BUILD SUCCESSFUL
Total time: 3 seconds