Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: InstrumentTask not working in JBoss 6.1 with Hibernate 3.6.6
PostPosted: Thu Jan 19, 2012 11:10 pm 
Beginner
Beginner

Joined: Tue Jun 21, 2005 1:36 am
Posts: 29
Location: Houston, TX
Some time ago I set up some lazy initialized @ManyToOne relationships. At that time I was using the
Code:
org.hibernate.tool.instrument.cglib.InstrumentTask

I was on JBoss 4.2.3 and this worked fine.
I switched to
Code:
org.hibernate.tool.instrument.javassist.InstrumentTask

when I upgraded to JBoss 6.1.0 final.

Per HHH-5451 support for cglib as a bytecode provider has been deprecated.

After noticing some performance problems, I found that this is not longer working. Below is my ant task for the instrumentation.

Code:
   <target name="instrument" depends="compile">
     <taskdef name="instrument" classname="org.hibernate.tool.instrument.javassist.InstrumentTask" >
       <classpath refid="build.classpath"/>
    </taskdef>
    <instrument verbose="true">
      <fileset dir="${jar.dir}/com/model">
        <include name="**/*.class" />
      </fileset>
    </instrument>
   </target>


The class files generated are larger when I instrument and if I display the contents of the .class file I can see that the javassist hooks have been added. I also verified that the classes inside the jar deployed inside my ear have been instrumented.

However, when running the application everything is eagerly loaded.

This is how I annotated my classes.
Code:
    private State state;
    @ManyToOne(fetch=FetchType.LAZY, optional=false)
    public State getState() { return this.state; }
    public void setState(State state) { this.state = state; }


I only recently addeed optional=false, but this made no difference.

I am not sure when this stopped working, but I figure it was when I upgraded JBoss and Hibernate several months ago. My application is now at a crawl.

I found this JIRA
https://hibernate.onjira.com/browse/HHH-1435
,but it show fixed many versions ago.

I would greatly appreciate any advice on how to debug this or hopefully an easy solution.

_________________
Thank you for your time,

Jason Long
CEO and Chief Software Engineer
BS Physics, MS Chemical Engineering
http://www.supernovasoftware.com
HJBUG Founder and President
http://www.hjbug.com


Top
 Profile  
 
 Post subject: Re: InstrumentTask not working in JBoss 6.1 with Hibernate 3.6.6
PostPosted: Thu Jan 19, 2012 11:12 pm 
Beginner
Beginner

Joined: Tue Jun 21, 2005 1:36 am
Posts: 29
Location: Houston, TX
I also tried the following with no difference.

Code:
    private State state;
    @ManyToOne(fetch=FetchType.LAZY, optional=false)
    @LazyToOne(LazyToOneOption.PROXY)
    @Fetch(FetchMode.SELECT)
    public State getState() { return this.state; }
    public void setState(State state) { this.state = state; }

_________________
Thank you for your time,

Jason Long
CEO and Chief Software Engineer
BS Physics, MS Chemical Engineering
http://www.supernovasoftware.com
HJBUG Founder and President
http://www.hjbug.com


Top
 Profile  
 
 Post subject: Re: InstrumentTask not working in JBoss 6.1 with Hibernate 3.6.6
PostPosted: Thu Jan 19, 2012 11:16 pm 
Beginner
Beginner

Joined: Tue Jun 21, 2005 1:36 am
Posts: 29
Location: Houston, TX
This is the base class is annotated as follows:
Code:
@Entity
@Table(name = "t_generic_item", schema="inventory")
@Inheritance(strategy=InheritanceType.JOINED )
public class GenericItem implements Serializable

_________________
Thank you for your time,

Jason Long
CEO and Chief Software Engineer
BS Physics, MS Chemical Engineering
http://www.supernovasoftware.com
HJBUG Founder and President
http://www.hjbug.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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.