-->
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.  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: did hibernate tools 5 only produce code of jdk5?
PostPosted: Fri Aug 26, 2005 7:50 pm 
Regular
Regular

Joined: Tue Dec 30, 2003 2:35 am
Posts: 85
i can produce some java code and hbm files,but
Code:
import static org.hibernate.criterion.Example.*;

it only work after jdk5,my application server is weblogic8,my weblogic8 use jdk1.4.2_02,not jdk5.

can i produce some java code and hbm files for jdk1.4.2???

thanks for you help!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 27, 2005 1:20 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
hmmm...must have missed that part...trivial to fix in the dao/dao.vm template as a workaround.

but please do also add it to the jira so we dont forget to fix that

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: tools generates code for jdk5
PostPosted: Wed Oct 26, 2005 1:56 pm 
Newbie

Joined: Wed Oct 26, 2005 1:43 pm
Posts: 1
The 3.1 beta1 release of the Hibernate Tools for Eclipse still produces the jdk5 code: import static. I couldn't find that any bug was filed in jira, so it must have been forgotten. Should I file one now?

Thanks,
Mike


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 2:41 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
hmm... it should not produce that unless you enable jdk5.

resubmit the bug if its there.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 27, 2005 3:10 am 
Newbie

Joined: Thu Oct 27, 2005 2:41 am
Posts: 6
Location: Cologne
I have the same problem.
Where can i find the option, to disable the jdk5 code generation?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 27, 2005 3:14 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
just dont enable generics and ejb3.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 27, 2005 8:11 am 
Newbie

Joined: Thu Oct 27, 2005 2:41 am
Posts: 6
Location: Cologne
i am using the ant tool to build a classes and daos from the ER-model. I am not using generics or ejb3 but i had to change the template entity.vm.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 27, 2005 8:13 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
huh? I don't have any entity.vm in the distribution/src code !?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 2:55 am 
Newbie

Joined: Thu Oct 27, 2005 2:41 am
Posts: 6
Location: Cologne
The changed template was daohome.vm .
I should have checked this before posting. :)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 2:58 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
so you were using a old copy of daohome.vm ?

the new one doesnt have this bug, correct?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 3:07 am 
Newbie

Joined: Thu Oct 27, 2005 2:41 am
Posts: 6
Location: Cologne
The Location is in the hibernate-tools.jar inside the HibernateTools-3.1.0.beta1.zip.

There are wrong Imports and methods findById and findByExample which generate jdk5 Code. My ant-task looks like:

<hibernatetool destdir="${build.dir}">
<jdbcconfiguration configurationfile="${misc.dir}/hibernate.cfg.xml"
propertyFile="${misc.dir}/hibernate.properties"
packagename="my.package"/>
<hbm2doc templatepath="${misc.dir}/templates" destdir="${doc.dir}/db"/>
<hbm2cfgxml templatepath="${misc.dir}/templates" destdir="${misc.dir}"/>
<hbm2hbmxml templatepath="${misc.dir}/templates" destdir="${src}"/>
<hbm2dao templatepath="${misc.dir}/templates" destdir="${src}"/>
<hbm2java templatepath="${misc.dir}/templates" destdir="${src}"/>
</hibernatetool>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 3:48 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you guys have to show me the exact lines in daoentity.vm which uses static import wrongly.

I can only see them included in the parts that is done when ejb3 is enabled; and that is jdk 1.5 only so what is the problem ? :)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 3:57 am 
Newbie

Joined: Thu Oct 27, 2005 2:41 am
Posts: 6
Location: Cologne
line3 $secondpassclassimports <-- this import returns

import static org.hibernate.criterion.Example.*;

line220 create should be Example.create

line 163 I had a primary key as long, maybe with a different mapping File this wouldnt be a error.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 4:20 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
but that line will only do static import if ImportContext.staticImport is called - and that only happens in the parts that are run when ejb3 is enabled.

provide a runnable a testcase to jira if you still think this is a bug.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 16, 2005 10:48 am 
Newbie

Joined: Wed Nov 16, 2005 7:40 am
Posts: 5
IMHO there are two problems, which produce JDK5-Code

1st
BIGINT fields from the database are not generated as Long but as long in the POJO-Classes. That works fine with JDK5 and autoboxing, but in JDK4 ... :-(

2nd
the template daohome.vm contains a line which results in the generaton of a static import:

--- begin snipplet from daohome.vm

#if($generics)
public ${pojo.importType("java.util.List")}<${declarationName}> findByExample(${declarationName} instance) {
#else
public ${pojo.importType("java.util.List")} findByExample(${declarationName} instance) {
#end
log.debug("finding ${declarationName} instance by example");
try {
#if($generics)
${pojo.importType("java.util.List")}<${declarationName}> results = (List<${declarationName}>) sessionFactory.getCurrentSession()
#else
${pojo.importType("java.util.List")} results = sessionFactory.getCurrentSession()
#end
.createCriteria("$clazz.entityName")
.add( $pojo.staticImport("org.hibernate.criterion.Example", "create")(instance) )
.list();
log.debug("find by example successful, result size: " + results.size());
return results;
}
catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
--- end snipplet from daohome.vm


Bye

Heinz


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

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.