<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>Learning by Experience &#187; jboss</title> <atom:link href="http://www.inze.be/andries/category/jboss/feed/" rel="self" type="application/rss+xml" /><link>http://www.inze.be/andries</link> <description>Java, Project Management, Life and anything else.</description> <lastBuildDate>Mon, 09 Jan 2012 21:38:00 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>JPA2 metamodel example</title><link>http://www.inze.be/andries/2010/09/19/jpa2-metamodel-example/</link> <comments>http://www.inze.be/andries/2010/09/19/jpa2-metamodel-example/#comments</comments> <pubDate>Sun, 19 Sep 2010 10:07:18 +0000</pubDate> <dc:creator>Andries Inzé</dc:creator> <category><![CDATA[jboss]]></category> <guid
isPermaLink="false">http://www.inze.be/andries/?p=240</guid> <description><![CDATA[JPA2 includes the new metamodel, which allows us to use JPA typesafe. To see what has changed since JPA 1, I can recommend this and this blog. Generating the metamodel turned out to be somewhat harder than I first thought. Since I&#8217;m a JBoss alcoholic, I&#8217;m using Hibernate as persistence provider with and the jpamodelgen [...]]]></description> <content:encoded><![CDATA[<p>JPA2 includes the new metamodel, which allows us to use JPA typesafe. To see what has changed since JPA 1, I can recommend <a
href="http://simonmartinelli.blogspot.com/2008/05/new-features-in-jpa-20.html">this</a> and <a
href="http://jazzy.id.au/default/2008/03/24/jpa_2_0_new_features_part_1.html">this</a> blog.</p><p>Generating the metamodel turned out to be somewhat harder than I first thought. <a
href="http://jbug.be/">Since I&#8217;m a JBoss alcoholic,</a> I&#8217;m using Hibernate as persistence provider with and the <a
href="http://www.hibernate.org/subprojects/jpamodelgen.html">jpamodelgen </a>subproject.</p><h2>Generating the metamodel</h2><p>According to the <a
href="http://docs.jboss.org/hibernate/stable/jpamodelgen/reference/en-US/html/chapter-usage.html#d0e261">official documentation</a>, all we need to do is add the hibernate-jpamodelgen to the classpath.</p><pre class="brush: xml; title: ; notranslate">&lt;dependency&gt;
    &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
    &lt;artifactId&gt;hibernate-jpamodelgen&lt;/artifactId&gt;
&lt;/dependency&gt;</pre><p>However, this resulted  in nothing. The only thing that did work for me was adding extra configuration with maven-annotation-plugin.</p><pre class="brush: xml; title: ; notranslate">&lt;plugin&gt;
    &lt;groupId&gt;org.bsc.maven&lt;/groupId&gt;
    &lt;artifactId&gt;maven-processor-plugin&lt;/artifactId&gt;
    &lt;executions&gt;
        &lt;execution&gt;
            &lt;id&gt;process&lt;/id&gt;
            &lt;goals&gt;
                &lt;goal&gt;process&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;phase&gt;generate-sources&lt;/phase&gt;
            &lt;configuration&gt;
                &lt;!-- source output directory --&gt;
                &lt;outputDirectory&gt;
target/metamodel
&lt;/outputDirectory&gt;
            &lt;/configuration&gt;
        &lt;/execution&gt;
    &lt;/executions&gt;
&lt;/plugin&gt;
&lt;plugin&gt;
    &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
    &lt;artifactId&gt;build-helper-maven-plugin&lt;/artifactId&gt;
    &lt;version&gt;1.3&lt;/version&gt;
    &lt;executions&gt;
        &lt;execution&gt;
            &lt;id&gt;add-source&lt;/id&gt;
            &lt;phase&gt;generate-sources&lt;/phase&gt;
            &lt;goals&gt;
                &lt;goal&gt;add-source&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
                &lt;sources&gt;
                    &lt;source&gt;target/metamodel&lt;/source&gt;
                &lt;/sources&gt;
            &lt;/configuration&gt;
        &lt;/execution&gt;
    &lt;/executions&gt;
&lt;/plugin&gt;</pre><p>Success! The User.java file</p><pre class="brush: java; title: ; notranslate">
@Entity
public class User implements UserDetails {
 /** The Constant serialVersionUID. */
 private static final long serialVersionUID = 1L;
 /** The user name. */
 @Id
 @Column(name = &quot;USER_ID&quot;)
 @Size(min = 3, max = 10)
 private String username;
 /** The password. */
 @NotNull
 @Size(min = 6, max = 40)
 @Column(name = &quot;PASSWORD&quot;)
 private String password;
 /** The name. */
 @Column(name = &quot;NAME&quot;)
 private String name;
 /** The first name. */
 @Column(name = &quot;FIRSTNAME&quot;)
 private String firstName;
</pre><p>was transformed into User_.java</p><pre class="brush: java; title: ; notranslate">import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@StaticMetamodel(User.class)
public abstract class User_ {
 public static volatile SingularAttribute&lt;User, String&gt; username;
 public static volatile SingularAttribute&lt;User, String&gt; name;
 public static volatile SingularAttribute&lt;User, String&gt; firstName;
 public static volatile SingularAttribute&lt;User, String&gt; password;
}
</pre><p>Now we can use the model to do typysafe queries:</p><pre class="brush: java; title: ; notranslate">
public UserDetails loadUserByUsername(final String username) throws UsernameNotFoundException,
 DataAccessException {
 CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
 CriteriaQuery&lt;User&gt; criteriaQuery = criteriaBuilder.createQuery(User.class);
 Root&lt;User&gt; u = criteriaQuery.from(User.class);
 Predicate usernameCondition = criteriaBuilder.equal(u.get(User_.username), username);
 criteriaQuery.where(usernameCondition);
 TypedQuery&lt;User&gt; query = entityManager.createQuery(criteriaQuery);
 try {
 return (User) query.getSingleResult();
 } catch (NoResultException e) {
 throw new UsernameNotFoundException(&quot;User not found: &quot; + username, e);
 }
 }
</pre>]]></content:encoded> <wfw:commentRss>http://www.inze.be/andries/2010/09/19/jpa2-metamodel-example/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Next JBUG.be event is out there!</title><link>http://www.inze.be/andries/2010/05/26/next-jbug-be-event-is-out-there/</link> <comments>http://www.inze.be/andries/2010/05/26/next-jbug-be-event-is-out-there/#comments</comments> <pubDate>Wed, 26 May 2010 19:18:38 +0000</pubDate> <dc:creator>Andries Inzé</dc:creator> <category><![CDATA[jboss]]></category> <guid
isPermaLink="false">http://www.inze.be/andries/?p=221</guid> <description><![CDATA[The program for our upcoming event is complete! Here it is&#8230; 18:00 &#8211; 19:00: Kabir Khan - What&#8217;s Cooking in JBoss AS 6 Kabir will talk about the JBoss AS 6 roadmap, the new development model, ongoing optimizations since AS 6. He will also give a bird&#8217;s eye overview of the new projects that will [...]]]></description> <content:encoded><![CDATA[<p>The program for our upcoming event is complete! Here it is&#8230;</p><p><strong>18:00 &#8211; 19:00: Kabir Khan</strong> <strong>- <em>What&#8217;s  Cooking in JBoss AS 6</em></strong></p><p>Kabir will talk about the JBoss AS 6 roadmap, the new development  model, ongoing optimizations since AS 6. He will also give a bird&#8217;s eye  overview of the new projects that will be bundled in AS 6, such as Weld,  HornetQ, RestEasy and several more. There will be a short demo at the  end showing some of the new features in AS.</p><p><strong>19:00 &#8211; 20:00: Kris Verlaenen &#8211; <em>Looking forward to the  future of (j)BPM</em></strong></p><p>There&#8217;s much going on in the area of BPM. This presentation will  offer you an overview of how the jBPM project will continue to offer you  business processes support (in their entire life cycle), while also  taking these new challenges into account, like more dynamic or adaptive  processes, standardization using the BPMN2 process definition language,  etc.</p><p>I think we can all agree on the fact that these talks will be very  interesting (to say the least).<br
/> So&#8230; do not forget to <a
href="http://www.jbug.be/index.php?view=details&amp;id=4%3Ajune+eventlist&amp;option=com_eventlist&amp;Itemid=53">register</a> for this event! (Maximium capacity is set to 45 people)</p><p>See you soon on the 3rd of June at <a
title="Xplore" href="http://www.xplore.be">Xplore</a> premises!</p><p><img
class="alignleft" title="Xplore" src="http://www.jbug.be/images/eventlist/venues/logo_1274853951.png" alt="" width="281" height="76" /> <img
class="alignright" title="JBUG.be" src="http://www.jbug.be/images/first_event/jbug.png" alt="" width="224" height="78" /></p> ]]></content:encoded> <wfw:commentRss>http://www.inze.be/andries/2010/05/26/next-jbug-be-event-is-out-there/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>jBPM Developer book review</title><link>http://www.inze.be/andries/2009/12/15/jbpm-developer-book-review/</link> <comments>http://www.inze.be/andries/2009/12/15/jbpm-developer-book-review/#comments</comments> <pubDate>Tue, 15 Dec 2009 21:54:22 +0000</pubDate> <dc:creator>Andries Inzé</dc:creator> <category><![CDATA[bpm]]></category> <category><![CDATA[jboss]]></category> <category><![CDATA[jbpm]]></category> <guid
isPermaLink="false">http://www.inze.be/andries/?p=205</guid> <description><![CDATA[Packt publishing is sending me a review copy of the jBPM Developer Guide. I&#8217;m looking forward to this book. The summary promises among others: Key concepts of Business Process Management to understand how the community leads and implements open source software Gain deep understanding of JPDL, the preferred process language, to know how your processes [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://www.packtpub.com/">Packt publishing</a> is sending me a review copy of the <a
href="http://www.packtpub.com/jboss-business-process-management-jbpm-developer-guide?utm_source=inze.be&amp;utm_medium=bookrev&amp;utm_content=blog&amp;utm_campaign=mdb_001841#indetail">jBPM Developer Guide</a>. I&#8217;m looking forward to this book. The summary promises among others:</p><ul><li> Key concepts of Business Process Management to understand how the community leads and implements open source software</li><li> Gain <strong>deep understanding </strong>of JPDL, the preferred process language, to know how your processes must be defined and implemented</li><li> Convert your projects into fully featured applications with advanced jBPM features such as the persistence service and human task mechanism</li><li> Understand the framework&#8217;s behavior in <strong>different environments</strong></li><li> Create and configure Human Task activities to model situations where human beings interact with the process</li><li> Understand how the framework handles information that flows through your business process</li><li> Configure the persistence service to <strong>reduce risk </strong>and perform successful implementations with jBPM</li><li> Improve your process definitions using nodes</li><li> Configure the Eclipse IDE to start modeling your processes</li></ul><p>Keep an eye on this blog to read the review.</p><p>Regards,<br
/> Andries</p> ]]></content:encoded> <wfw:commentRss>http://www.inze.be/andries/2009/12/15/jbpm-developer-book-review/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Documentation Spring jBPM integration</title><link>http://www.inze.be/andries/2009/06/28/documentation-spring-jbpm-integration/</link> <comments>http://www.inze.be/andries/2009/06/28/documentation-spring-jbpm-integration/#comments</comments> <pubDate>Sun, 28 Jun 2009 19:11:33 +0000</pubDate> <dc:creator>Andries Inzé</dc:creator> <category><![CDATA[jboss]]></category> <category><![CDATA[jbpm]]></category> <guid
isPermaLink="false">http://www.inze.be/andries/?p=159</guid> <description><![CDATA[Any project, especially open source projects, rise or fall with proper documentation. Following post serves a dual purpose, it&#8217;s a blog post (duh) but also a first draft for the devguide documentation of jBPM4. Things might sound a little weird, but that&#8217;s the reason. Design Transaction Management A typical Spring application defines transaction management and [...]]]></description> <content:encoded><![CDATA[<p>Any project, especially open source projects, rise or fall with proper documentation. Following post serves a dual purpose, it&#8217;s a blog post (duh) but also a first draft for the <a
href="http://docs.jboss.com/jbpm/v4.0/devguide/html_single/">devguide documentation</a> of jBPM4. Things might sound a little weird, but that&#8217;s the reason.</p><h2>Design</h2><h3>Transaction Management</h3><p>A typical Spring application defines transaction management and ORM definition.  It follows following scheme:</p><p><a
href="http://www.inze.be/andries/wp-content/Screenshot-1.png.jpg"><img
class="alignnone size-thumbnail wp-image-164" title="Screenshot-1.png" src="http://www.inze.be/andries/wp-content/Screenshot-1.png-150x150.jpg" alt="Screenshot-1.png" width="150" height="150" /></a></p><p>Applications are accessed from the web tier and enter the transactional boundary by invoking service beans. These service beans will access the jBPM services. Spring users expect that all these operations run in a single transaction, which as we&#8217;ll see makes testing a lot easier.</p><p>In reality, we replace the standard-transaction-interceptor by a spring-transaction interceptor. Instead of starting and committing transactions, we want to reuse any existing transactions (which was already started by Spring).</p><p>The same is true for the hibernate session, which will be available through Spring.</p><h3>Spring Context</h3><p>JBPM4 comes with multiple contexts, which contains beans. With the <em>SpringContext</em>, we add the Spring Application Context to this set of contexts.</p><h2>Configuration</h2><p>Replace the <em>standard-transaction-interceptor</em> with the <em>spring-transaction-interceptor</em>.</p><p>The hibernate session needs the attribute <em>current=&#8221;true&#8221;.</em> This forces jBPM to search for the current session, which will be provided by Spring.</p><p>For the Spring context to be known, we created a <em>SpringConfiguration</em>. This extends the <em>JbpmConfiguration</em> but will add itself as a context. The single constructor take the location of the jBPM configuration.</p><pre>&lt;bean id="jbpmConfiguration" class=”org.jbpm.pvm.internal.cfg.SpringConfiguration”&gt;
   &lt;constructor-arg value="be/inze/spring/demo/jbpm.cfg.xml" /&gt;
&lt;/bean&gt;</pre><p>The services can also be defined in the Spring applicationContext, as following:</p><pre>&lt;bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="buildProcessEngine" /&gt;
&lt;bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" /&gt;
&lt;bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" /&gt;</pre><p>For accessing Spring beans from a process, we need to register the Spring applicationContext. This can be done as following:</p><pre>&lt;script-manager default-expression-language="juel"
 default-script-language="juel"
 read-contexts="execution, environment, process-engine, <strong>spring</strong>"
 write-context=""&gt;
 &lt;script-language name="juel"
 factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" /&gt;
 &lt;/script-manager&gt;</pre><h2>Use</h2><p>In jBPM4 most development will happen through the client API aka the services. Simple inject these beans into your transactional service methods and start using them.</p><p>Invoking Spring beans from a process can be done as following:</p><pre>&lt;java name="echo" expr="#{echoService}" method="sayHello" &gt;
    &lt;transition name="to accept" to="join1"/&gt;
 &lt;/java&gt;</pre><p>The scripting engine will look into all contexts from the bean named <em>echoService</em>. If you configured the ScriptManager as above, Spring will be the last context to search for. A good practice is to use unique names for the beans.</p><h2>Testing</h2><p>With the <em>AbstractTransactionalJbpmTestCase</em> we can test the process in isolation. Extending from <em>AbstractTransactionalDataSourceSpringContextTests</em> we can test like we test our DAO&#8217;s.</p><p>Any feedback is appreciated.</p><p>KR,<br
/> Andries</p> ]]></content:encoded> <wfw:commentRss>http://www.inze.be/andries/2009/06/28/documentation-spring-jbpm-integration/feed/</wfw:commentRss> <slash:comments>53</slash:comments> </item> <item><title>Demo on Spring Integration with jBPM4</title><link>http://www.inze.be/andries/2009/05/16/demo-on-spring-integration-with-jbpm4/</link> <comments>http://www.inze.be/andries/2009/05/16/demo-on-spring-integration-with-jbpm4/#comments</comments> <pubDate>Sat, 16 May 2009 19:43:53 +0000</pubDate> <dc:creator>Andries Inzé</dc:creator> <category><![CDATA[jboss]]></category> <guid
isPermaLink="false">http://www.inze.be/andries/?p=122</guid> <description><![CDATA[After my presentation at J-Spring, I received a lot of feedback. The general question was how the Spring Integration would fit into a project. To fulfill this question, I have created following demo, which I&#8217;ll discuss in detail. I have chosen a typical JSF-Spring-Hibernate stack as a base, and added jbpm4. The demo starts simple [...]]]></description> <content:encoded><![CDATA[<p>After my presentation at J-Spring, I received a lot of feedback. The general question was how the Spring Integration would fit into a project. To fulfill this question, I have created following demo, which I&#8217;ll discuss in detail.</p><p>I have chosen a typical JSF-Spring-Hibernate stack as a base, and added jbpm4. The demo starts simple processes, just to prove the integration is a working fact.</p><p>This is release 0.1, which means I just finished a rudimentary version. However, I&#8217;ll keep updating and adding following features:</p><ul><li>Timers</li><li>Forks</li><li>Invoking Spring beans</li><li>&#8230;</li></ul><p>Don&#8217;t hesitate to subscribe so you&#8217;ll find out when newer versions are available.</p><h2>Installation from SVN</h2><ol><li>Checkout<tt
id="checkoutcmd"><br
/> </tt></p><pre><tt id="checkoutcmd">svn checkout <strong><em>
http</em></strong>://jbpm4-spring-demo.googlecode.com/svn/trunk/
jbpm4-spring-demo-read-only
(All on 1 line)
</tt></pre></li><li>Download the<a
href="http://jbpm4-spring-demo.googlecode.com/files/maven-dependencies-0.1.tar.gz"> jbpm4 maven dependencies</a>. The spring integration is not yet part of any released jbpm4. Extract them into the <em>org</em> folder in your .m2/repository folder.</li><li>enter following maven command in your checked out folder:<pre> mvn jetty:run</pre></li></ol><h2>Running just the WAR:</h2><ol><li>Download the<a
href="http://jbpm4-spring-demo.googlecode.com/files/jbpm4-spring-demo.war"> war file</a>.</li><li>Drop it into jboss, tomcat, &#8230; and run it.</li></ol><h2>The integration:</h2><p>If you would like to find more information about how it&#8217;s done, please look at my slides<a
href="http://www.inze.be/andries/2009/04/16/slides-from-j-spring/" target="_blank"> here</a>.</p><p>The short version: We remove some dependencies from the jbpm-config, and add them into the spring-config. The integration will then search the required dependencies in the jbpm-contexts and then move on to the spring-context.</p><p>The dependencies we want Spring to provide are following:</p><ul><li>Hibernate Session factory</li><li>Transaction Manager</li></ul><p>But in essence other dependencies could be added. Since jBPM4 uses Hibernate for persistence, we need to add the mapping files to the sessionfactory:<br
/> From applicationContext-common.xml:</p><pre>&lt;bean id="sessionFactory"
	class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"&gt;
	&lt;property name="dataSource" ref="dataSource" /&gt;
	&lt;property name="hibernateProperties"&gt;
		&lt;props&gt;
			&lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.HSQLDialect&lt;/prop&gt;
			&lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
			&lt;prop key="hibernate.hbm2ddl.auto"&gt;create-drop&lt;/prop&gt;
		&lt;/props&gt;
	&lt;/property&gt;
	&lt;property name="configLocations"&gt;
		&lt;list&gt;
			&lt;value&gt;classpath:be/inze/spring/demo/hibernate.cfg.xml&lt;/value&gt;
		&lt;/list&gt;
		&lt;/property&gt;
	&lt;property name="mappingLocations"&gt;
		&lt;list&gt;
			<strong>&lt;value&gt;classpath:jbpm.execution.hbm.xml&lt;/value&gt;
			&lt;value&gt;classpath:jbpm.repository.hbm.xml&lt;/value&gt;
			&lt;value&gt;classpath:jbpm.jpdl.hbm.xml&lt;/value&gt;
			&lt;value&gt;classpath:jbpm.task.hbm.xml&lt;/value&gt;
			&lt;value&gt;classpath:jbpm.history.hbm.xml&lt;/value&gt;</strong>
		&lt;/list&gt;
	&lt;/property&gt;
&lt;/bean&gt;</pre><p>Own hbm files can be added as well (or mixed with annotations).</p><p>The jbpm.cfg.xml has been altered a bit. Changes (2 of them) are marked in bold:<br
/> From jbpm.cfg.xml:</p><pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;jbpm-configuration xmlns="http://jbpm.org/xsd/cfg"&gt;
  &lt;process-engine-context&gt;
    &lt;repository-service /&gt;
    &lt;repository-cache /&gt;
    &lt;execution-service /&gt;
    &lt;history-service /&gt;
    &lt;management-service /&gt;
    &lt;task-service /&gt;
    &lt;identity-service /&gt;
    &lt;command-service&gt;
      &lt;retry-interceptor /&gt;
      &lt;environment-interceptor /&gt;
    <strong>  &lt;spring-transaction-interceptor current="true"/&gt;</strong>
    &lt;/command-service&gt;
    &lt;hibernate-configuration&gt;
      &lt;cfg resource="jbpm.hibernate.cfg.xml" /&gt;
    &lt;/hibernate-configuration&gt;
    &lt;deployer-manager&gt;
      &lt;jpdl-deployer /&gt;
    &lt;/deployer-manager&gt;
    &lt;script-manager default-expression-language="juel"
                    default-script-language="juel"
                    read-contexts="execution, environment,
                                   process-engine"
                    write-context=""&gt;
        &lt;script-language name="juel"
factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" /&gt;
    &lt;/script-manager&gt;
    &lt;authentication /&gt;
    &lt;job-executor auto-start="false" /&gt;
    &lt;id-generator /&gt;
    &lt;types resource="jbpm.variable.types.xml" /&gt;
    &lt;business-calendar&gt;
      &lt;monday    hours="9:00-12:00 and 12:30-17:00"/&gt;
      &lt;tuesday   hours="9:00-12:00 and 12:30-17:00"/&gt;
      &lt;wednesday hours="9:00-12:00 and 12:30-17:00"/&gt;
      &lt;thursday  hours="9:00-12:00 and 12:30-17:00"/&gt;
      &lt;friday    hours="9:00-12:00 and 12:30-17:00"/&gt;
      &lt;holiday period="01/07/2008 - 31/08/2008"/&gt;
    &lt;/business-calendar&gt;
  &lt;/process-engine-context&gt;
  &lt;transaction-context&gt;
    &lt;repository-session /&gt;
    &lt;pvm-db-session /&gt;
    &lt;job-db-session /&gt;
    &lt;task-db-session /&gt;
    &lt;message-session /&gt;
    &lt;timer-session /&gt;
    &lt;history-session /&gt;
    &lt;transaction /&gt;
    &lt;hibernate-session /&gt;
    &lt;hibernate-session <strong>current="true"</strong> /&gt;
    &lt;identity-session /&gt;
  &lt;/transaction-context&gt;
&lt;/jbpm-configuration&gt;</pre><p><strong>spring-transaction-interceptor: </strong>The standard-transaction-interceptor will start and commit transactions. Instead, we want jbpm to reuse an existing transaction. The <strong>current=true</strong> forces the interceptor to check if a transaction already exists. It will crash else. On current=false, a new transaction will be created.</p><p>&lt;hibernate-session <strong>current=&#8221;true&#8221;</strong> /&gt;: The <strong>current=true </strong>defines that we will use the hibernate-session that is available, no new one will be created.</p><h2>Exposing beans:</h2><p>When configuration is done, one can access the beans as follows:</p><pre>&lt;bean id="jbpmConfiguration"
   class="org.jbpm.pvm.internal.cfg.SpringConfiguration"&gt;
	&lt;constructor-arg
          value="be/inze/spring/demo/jbpm.cfg.xml" /&gt;
&lt;/bean&gt;
&lt;bean id="processEngine" factory-bean="jbpmConfiguration"
   factory-method="buildProcessEngine" /&gt;
&lt;bean id="repositoryService" factory-bean="processEngine"
   factory-method="getRepositoryService" /&gt;
&lt;bean id="executionService" factory-bean="processEngine"
   factory-method="getExecutionService" /&gt;</pre><h2>Feedback</h2><p>Any feedback, positive AND negative is highly appreciated, either by comment or mail me at <a
href="http://safemail.justlikeed.net/" target="_blank"><img
title="Email image created with safemail.justlikeed.net" src="http://safemail.justlikeed.net/e/56579c4052b17e775226aee635651059.png" border="0" alt="" align="absbottom" /></a></p> ]]></content:encoded> <wfw:commentRss>http://www.inze.be/andries/2009/05/16/demo-on-spring-integration-with-jbpm4/feed/</wfw:commentRss> <slash:comments>48</slash:comments> </item> <item><title>12 things I bet you didn&#8217;t know about Hibernate</title><link>http://www.inze.be/andries/2008/08/25/12-things-i-bet-you-didnt-know-about-hibernate/</link> <comments>http://www.inze.be/andries/2008/08/25/12-things-i-bet-you-didnt-know-about-hibernate/#comments</comments> <pubDate>Mon, 25 Aug 2008 21:08:41 +0000</pubDate> <dc:creator>Andries Inzé</dc:creator> <category><![CDATA[jboss]]></category> <guid
isPermaLink="false">http://www.inze.be/andries/?p=51</guid> <description><![CDATA[I&#8217;ve been working with Hibernate for the past 2 years, doing multiple projects with the framework. With this experience, I thought I pretty much had Hibernate figured out and knew what was possible and what wasn&#8217;t. Now this month, I have been prepping for a course I&#8217;ll give about the framework and to my great [...]]]></description> <content:encoded><![CDATA[<p>I&#8217;ve been working with Hibernate for the past 2 years, doing multiple projects with the framework. With this experience, I thought I pretty much had Hibernate figured out and knew what was possible and what wasn&#8217;t. Now this month, I have been prepping for a course I&#8217;ll give about the framework and to my great surprise I actually learned a lot! I&#8217;m more then happy to share some of this new cool stuff I&#8217;ve found out!</p><h2>noop field type</h2><p>noop field&#8217;s are columns that exist in the database, but not in your class. Sometimes handy for calculated values are connecting to legacy databases. We actually encountered such a use case, where the data conversion from an old application gave some data which we didn&#8217;t want to see or alter in the new application. But as a reporting query, we did want to show which data was old. We actually didn&#8217;t use the noop (didn&#8217;t knew about it), but it would have made a great use case.</p><h2>NamingStrategy</h2><p>In my first project, we declared naming standards for tables and column. Although we abide them, we did it manually. The NamingStrategy would let us declare those standards automatically. In our use case, we suffixed Boolean columns with _B, and enum states with _S , etc&#8230; . A good NamingStrategy would have done this automatically.</p><h2>Bags don&#8217;t need to be loaded when inserts happen</h2><p>Since no filtering or ordering is required, one can insert data into a Bag, without triggering the lazy loading of the entire bag. This is, in a lot of use cases, a great performance gain. In our teams, we do batch processing regularly where we insert a lot of data. This would have been faster if we used the Bag interface (instead of the more common Set).</p><h2>Replicating</h2><p>You can compare it with merging, but only you are not reattaching a detached object, you are attaching an object with a different database. Never ever had to use this, but it was still a gem I didn&#8217;t know about.</p><h2>Persist() vs save()  (persist does not cascade)</h2><p>I just didn&#8217;t know this. What would be a good use case for this?</p><h2>.addEntity</h2><p>session.createSQLQuery(<br
/> &#8220;select {c.*} from CATEGORY {c} where NAME like &#8216;Laptop%&#8217;&#8221;<br
/> ).addEntity(&#8220;c&#8221;, Category.class);</p><h2>HQL new keyword</h2><p>I&#8217;m absolutely crazy about this one. Following is a standard idiom in the projects I&#8217;ve worked in: we do some search query with HQL and we map, by hand, the result into our own custom created result object. All the mapping, type conversion etc we do is just a waste of time! Don&#8217;t know what I&#8217;m talking about? Here is an example:</p><blockquote><p>select new UserSearchResult(u.id, u.name, u.birthDate) from User u where &#8230;</p></blockquote><p>The <em>UserSearchResult</em> is a plain POJO (with either needs to be declared or fully qualified). The solution is simple and clean. Absolutely love it!</p><h2>Query.setProperties()</h2><p>This one is also a <em>type-safer</em> (as in life-saver). Fill in the entire object and let HQL get the values by reflection. Beats the hell out of determining setString or setDouble etc.</p><blockquote><p>Item item = new Item();<br
/> item.setSeller(seller);<br
/> item.setDescription(description);<br
/> String queryString = &#8220;from Item item&#8221;<br
/> + &#8221; where item.seller = :seller and item.description like :description&#8221;;<br
/> session.createQuery(queryString).setProperties(item);</p></blockquote><p>It again safes you some typing.</p><h2>Query hints</h2><p>FlushMode: very good for search results and batch jobs (will not trigger a flush before the query)</p><p>setReadonly: very good for search results (disabled dirty checking)</p><p>setTimeout: a default should be set for every query.<br
/> Actually this is very important. We have had applications which, due to bug or db crash, kept a lock for hours. No (normal) query should take more then, oh lets say, 60sec. Setting the timeout on all query to this is a safe precaution.</p><h2>Using named queries</h2><p>Using named queries abstracts the query definition from your DAO layer. I believe this to be a nice addition, something that could be done after the implementation. You can define the query on class level (in the class.hbm.xml) or on an application wide scope, so you can reuse them across multiple DAO&#8217;s. Never actually came across a query I&#8217;d reuse across multiple dao&#8217;s though&#8230;</p><h2>MatchMode.START</h2><p>On most of my projects we write a DaoUtil that would prefix/suffix the search input, with the right wild card.  Now it seems Hibernate provided a shortcut to this (all along).<br
/> e.g. Restrictions.like(&#8220;streetname&#8221;, &#8220;G&#8221;, MatchMode.START)</p><h2>Projections.projectionList</h2><p>This let&#8217;s you search on some fields, instead of complete objects using Criteria. I&#8217;ve always found it strange that Criteria queries only returned complete objects. Seems that my ignorance was to blame <img
src='http://www.inze.be/andries/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><blockquote><p>session.createCriteria(User.class)<br
/> .setProjection( Projections.projectionList()<br
/> .add( Property.forName(&#8220;id&#8221;) )<br
/> .add( Property.forName(&#8220;username&#8221;) )<br
/> .add( Property.forName(&#8220;birthDate&#8221;) )<br
/> );</p></blockquote><h2>Conclusion</h2><p>Never too old to learn? <img
src='http://www.inze.be/andries/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>You can&#8217;t learn everything the first time round. It&#8217;s only after larger experience you truly start to see all the finesse of a framework. I truly believe in studying everything twice. With Spring, I had the same insight after going back 2 basic on it after doing a complete project with it. Now with Hibernate, I see the same enlightement for me.</p> ]]></content:encoded> <wfw:commentRss>http://www.inze.be/andries/2008/08/25/12-things-i-bet-you-didnt-know-about-hibernate/feed/</wfw:commentRss> <slash:comments>14</slash:comments> </item> <item><title>Book Review: JBoss jBPM</title><link>http://www.inze.be/andries/2007/11/26/book-review-jboss-jbpm/</link> <comments>http://www.inze.be/andries/2007/11/26/book-review-jboss-jbpm/#comments</comments> <pubDate>Mon, 26 Nov 2007 20:16:17 +0000</pubDate> <dc:creator>Andries Inzé</dc:creator> <category><![CDATA[bpm]]></category> <category><![CDATA[jboss]]></category> <category><![CDATA[jbpm]]></category> <guid
isPermaLink="false">http://www.inze.be/andries/?p=17</guid> <description><![CDATA[I&#8217;m currently working on a project which integrates Spring Webflow and jBPM. As a newbie, I&#8217;ve learned about the availability of review copy&#8217;s of the book: Business Process Management with JBoss jBPM, written by Matt Cumberlidge and published by PACKT Publishing. So in practice I&#8217;ve got a free book in exchange for this review. The [...]]]></description> <content:encoded><![CDATA[<p>I&#8217;m currently working on a project which integrates Spring Webflow and jBPM. As a newbie, I&#8217;ve learned about the availability of review copy&#8217;s of the book: Business Process Management with JBoss jBPM, written by Matt Cumberlidge and published by PACKT Publishing. So in practice I&#8217;ve got a free book in exchange for this review.</p><p>The book is intended as an good introduction into the BPM world, primarily for Business Analysts. For developers it promises a useful introduction to the key concepts with directions for implementing BPM the right way.</p><h2>Things I didn&#8217;t like:</h2><p>Let&#8217;s start with the easy part, trashing parts of the book. My first thought I had when I received the book, is that it&#8217;s rather small. With only a good 200 pages, stuffed with screenshots and code examples, the book is practically read in a day.  And that is with every exercise made. Of course, you could also argue this is positive, but this brings me to my second issue: the book is not thoroughly enough for developers. I like to code and I need coding guidelines to do that. This book does not provide that.</p><h2>Things I liked:</h2><p>It&#8217;s a good thing that there are a lot more things I liked about the book. Firstly, the book actually delivers what it says: providing a good introduction into the jBPM world. Instead of being a reference book, it&#8217;s a hands-on book for Business Analysts. It&#8217;s short, to the point and very easy to read cover to cover.</p><p>The code examples just work! This seems normal, but it ain&#8217;t. I&#8217;ve read my share of books where the examples always needed a little magic to work. There is one catch: the examples work for jBPM Designer 3.2 (suite).  They do not work with 3.2.2. I don&#8217;t know why or how, but the 3.2.2 version actually has LESS features then the older version. Took me a while to find it. (Actually, this is a negative&#8230;).</p><p>There is always a trade-off: provide a decent small examples, or deliver a large complete example. This book chose the latter, which would be way to large if they didn&#8217;t provide the example in real code, for each chapter. So you can start the next chapter with only the code you would have written in the previous one. Very well done! Makes it all the more fun to actually follow the examples throughout the book.</p><p>It handles stuff that&#8217;s pure BPM, and not only jBPM. It talks about kick-off meetings, project sponsors and <a
href="http://en.wikipedia.org/wiki/Subject_Matter_Expert" target="_blank">SME</a>&#8216;s. This helps deliver a good broad image of BPM.</p><h2>Conclusion</h2><p>I recommend this book to anyone who wants to learn about jBPM. It&#8217;s actually a fantastic book, if you know what it will deliver. Hands one experience from a business analysts view, nothing more, nothing less! For a developer like myself, it doesn&#8217;t provide the answers to actually create a full-wedged application with it, but it&#8217;ll help paving the way.</p><p>Andries</p> ]]></content:encoded> <wfw:commentRss>http://www.inze.be/andries/2007/11/26/book-review-jboss-jbpm/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> </channel> </rss>
