-->
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.  [ 9 posts ] 
Author Message
 Post subject: hbm2java ignoring several meta attributes
PostPosted: Wed Mar 16, 2005 6:25 am 
Beginner
Beginner

Joined: Mon Mar 07, 2005 9:15 am
Posts: 26
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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 16, 2005 7:19 am 
Beginner
Beginner

Joined: Mon Mar 07, 2005 9:15 am
Posts: 26
I have just seen an error. I said extra-attribute, but it should be extra-import.
Sorry for the error.

Hugo.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 16, 2005 9:59 am 
Beginner
Beginner

Joined: Mon Mar 07, 2005 9:15 am
Posts: 26
Hi,

After checking on another issue related to configuration and Ant tasks set-up, I
figured the problem is not with my set-up but something else. I did a little
snooping in the JIRA and found what seems to be the root of the problem:

Meta attributes of properties are not generated in POJO classes
http://opensource.atlassian.com/project ... se/HBX-135

HTHs,
Hugo Ferreira.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 17, 2005 11:55 am 
Beginner
Beginner

Joined: Mon Mar 07, 2005 9:15 am
Posts: 26
Hi,

Just in case anyone is keeping tabs on this.
Seems like this has been fixed in 3.0alpha2 thanks
to peilinz (reporter) and Max Rydahl Andersen (developer).

Hugo F.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 17, 2005 2:41 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
please add a jira for the extra-import meta attribute - i think that is missing.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 18, 2005 4:08 am 
Beginner
Beginner

Joined: Mon Mar 07, 2005 9:15 am
Posts: 26
Ok, as soon as HibernateExt compiles I will repeat the test.
If this fails I will report it.

Thanks,
Hugo F.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 18, 2005 8:11 am 
Beginner
Beginner

Joined: Mon Mar 07, 2005 9:15 am
Posts: 26
Hi,

Compiled and used the new version of HibernateExt. Same problem.
Neither the class-code nor the extra-import work. The class-description
as before works ok. Need I place this in the Jira?

TIA,
Hugo F.



<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[
private String user;
private int access_per_group;

public Child(Session s) {
user = s.getUser();
int[] access = (int[])s.getAccessRights("browser.actor");

setG1( new Integer( access[0] ) );
setG2( new Integer( access[1] ) );
}
]]>
</meta>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 18, 2005 9:00 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
please do.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 18, 2005 9:48 am 
Beginner
Beginner

Joined: Mon Mar 07, 2005 9:15 am
Posts: 26
Done.

http://opensource.atlassian.com/project ... se/HBX-149


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 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.