-->
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: buildtime bytecode instrumentation for lazy loading
PostPosted: Tue Jul 20, 2010 6:35 pm 
Newbie

Joined: Tue Jul 20, 2010 6:20 pm
Posts: 1
Hi, I'm trying to implement lazy property loading, but according to the documentation, I need to buildtime bytecode instrumentation.

I've tried multiple tutorials on it from around the internet and can't seem to get it to work. I've tried using Ant Tasks and Maven Pom, but I couldn't get either. I'm guessing that I'm missing something simple, but if someone could help me out, that would be great. Thanks!


Top
 Profile  
 
 Post subject: Re: buildtime bytecode instrumentation for lazy loading
PostPosted: Wed Jul 21, 2010 4:45 am 
Regular
Regular

Joined: Thu May 07, 2009 5:56 am
Posts: 94
Location: Toulouse, France
buildtime bytecode instrumentation is only required if you want use lazy loading for basic properties (String, byte[], etc).

for lazy loading associations just use fetch plan in your mapping e.g: @OneToOne(fetch = FetchType.LAZY)

for lazy loading basic properties: @Basic(fetch = FetchType.LAZY) and enhance your entities with Ant task like:
Code:
<project name="enhance" basedir="." default="instrument">
   <property name="root_dir" value="/libraries" />

   <path id="compilation.classpath.id">
      <fileset dir="${root_dir}/hibernate">
         <include name="*.jar" />
      </fileset>
      <fileset dir="${root_dir}/javassist">
         <include name="*.jar" />
      </fileset>
      <fileset dir="${root_dir}/slf4j">
         <include name="*.jar" />
      </fileset>
      <fileset dir="${root_dir}/log4j">
         <include name="*.jar" />
      </fileset>
   </path>

   <target name="instrument">
      <taskdef name="hibernateinstrument" classname="org.hibernate.tool.instrument.javassist.InstrumentTask">
         <classpath>
            <path refid="compilation.classpath.id" />
            <pathelement path="bin" />
         </classpath>
      </taskdef>
      <hibernateinstrument verbose="true">
         <fileset dir="bin">
            <include name="**/*.class" />
         </fileset>
      </hibernateinstrument>
   </target>
</project>

_________________
everything should be made as simple as possible, but not simpler (AE)


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.