| <html><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 7. Working with Common Enterprise Libraries</title><meta content="DocBook XSL Stylesheets V1.76.0" name="generator"><link rel="home" href="index.html" title="Virgo Programmer Guide"><link rel="up" href="index.html" title="Virgo Programmer Guide"><link rel="prev" href="ch06s07.html" title="Form Tags as a Plan"><link rel="next" href="ch07s02.html" title="Working with DataSources"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table summary="Navigation header" width="100%"><tr><td align="left" width="20%"><a accesskey="p" href="ch06s07.html">Prev</a> </td><th align="center" width="60%"> </th><td align="right" width="20%"> <a accesskey="n" href="ch07s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 7. Working with Common Enterprise Libraries"><div class="titlepage"><div><div><h2 class="title"><a name="common-libraries"></a>Chapter 7. Working with Common Enterprise Libraries</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ch07.html#common-libraries-hibernate">Working with Hibernate</a></span></dt><dd><dl><dt><span class="section"><a href="ch07.html#common-libraries-hibernate-import">Importing Hibernate</a></span></dt></dl></dd><dt><span class="section"><a href="ch07s02.html">Working with DataSources</a></span></dt><dt><span class="section"><a href="ch07s03.html">Weaving and Instrumentation</a></span></dt><dt><span class="section"><a href="ch07s04.html">JSP Tag Libraries</a></span></dt></dl></div><div class="section" title="Working with Hibernate"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="common-libraries-hibernate"></a>Working with Hibernate</h2></div></div></div><div class="section" title="Importing Hibernate"><div class="titlepage"><div><div><h3 class="title"><a name="common-libraries-hibernate-import"></a>Importing Hibernate</h3></div></div></div><p> |
| Hibernate uses CGLIB to dynamically create subclasses of your entity types at |
| runtime. To guarantee that Hibernate and CGLIB can correctly see the types, |
| you must add an <code class="literal">Import-Library</code> or <code class="literal">Import-Bundle</code> for the Hibernate library or bundle |
| into any bundle that uses Hibernate directly. |
| </p><p> |
| Additionally, if other bundles in your application contain types to be persisted by Hibernate, then be sure to specify the <code class="code">import-scope</code> directive of the <code class="literal">Import-Bundle</code> header in the bundle that uses Hibernate directly. The <code class="literal">import-scope</code> directive tells Virgo Server for Apache Tomcat to implicitly import the bundle into all other bundles that make up the application; this ensures that bundles that indirectly depend on the generated Hibernate classes have access to them, but you do not have to explicitly update their <code class="code">Import-Bundle</code> header, ensuring modularity. For example: |
| </p><pre class="programlisting"> |
| Import-Bundle: com.springsource.org.hibernate;version="[3.2.6.ga,3.2.6.ga]";<span class="bold"><strong>import-scope:=application</strong></span></pre><p> |
| The <code class="code">import-scope</code> directive works only for the bundles in a scoped application (PARs or plans.) |
| </p></div></div></div><div class="navfooter"><hr><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="ch06s07.html">Prev</a> </td><td align="center" width="20%"> </td><td align="right" width="40%"> <a accesskey="n" href="ch07s02.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%"> </td><td align="center" width="20%"><a accesskey="h" href="index.html">Home</a></td><td valign="top" align="right" width="40%"> </td></tr></table></div></body></html> |