Sarasvati and JBoss 7

28 views
Skip to first unread message

Luca Visconti

unread,
Nov 9, 2012, 11:25:22 AM11/9/12
to sarasvat...@googlegroups.com
Hi all,
 I've modified Sarasvati for working with JBoss 7.

To achieve this result you have to patch some sources ( see attachment src.diff, apply to src directory ), change hibernate libraries ( use the one from JBoss modules directory ) in lib:
hibernate-commons-annotations-4.0.1.Final.jar
hibernate-core-4.0.1.Final.jar
hibernate-entitymanager-4.0.1.Final.jar
hibernate-infinispan-4.0.1.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar

and then recompile ( ant dist ).

Use the resulting library for creating Jboss 7 module:
- create a directory $JBOSS_HOME/modules/com/googlecode/sarasvati/main
- use the module.xml in the attachment and add libraries from lib directory as described in the module.xml

Now you are ready to create you EJB project:
Prepare a persistence.xml and jbpm-deployment-structure.xml as the one in the attachment ( provide your own datasource ).

Use sarasvati as in the following example:
-- Don't worry about schema update ( JPA will update the schema ).

package biz.opengate.testsarasvati;

import java.io.File;

import javax.annotation.PostConstruct;
import javax.ejb.LocalBean;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.hibernate.Session;

import com.googlecode.sarasvati.Graph;
import com.googlecode.sarasvati.GraphProcess;
import com.googlecode.sarasvati.hib.HibEngine;

/**
 * Session Bean implementation class Mai
 */
@Singleton
@LocalBean
@Startup
public class Main {

@PersistenceContext(unitName = "TestSarasvati")
private EntityManager em;
/**
     * Default constructor. 
     */
    public Main() {
        // TODO Auto-generated constructor stub
    }
    
    @PostConstruct
    public void postConstruct() {
   
    HibEngine engine = new HibEngine(em.unwrap(Session.class));

    File file = new File(this.getClass().getResource("helloworld.wf.xml").getFile());
    engine.getLoader().load( file );
    Graph graph = engine.getRepository().getLatestGraph( "hello-world" );
    GraphProcess process = engine.startProcess( graph );

    }
    

}







src.diff
module.xml
persistence.xml
jboss-deployment-structure.xml

Paul Lorenz

unread,
Nov 9, 2012, 7:09:58 PM11/9/12
to sarasvat...@googlegroups.com
Hi Luca,
  Thank you for posting this. It looks like this might be against the latest release. It's possible that some of this work might already be done in trunk, which is working against hibernate 3.6 and 4.1. I'll take a look at this weekend, though, and see what deltas there.

Cheers,
Paul









--
You received this message because you are subscribed to the Google Groups "sarasvati-wf-dev" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sarasvati-wf-dev/-/5EUlJ5eo_hEJ.
To post to this group, send email to sarasvat...@googlegroups.com.
To unsubscribe from this group, send email to sarasvati-wf-d...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sarasvati-wf-dev?hl=en.

Reply all
Reply to author
Forward
0 new messages