Eclipse RCP+Spring+EMF+Teneo

One issue for using these technologies together is using spring and the teneo HbSessionDataStore versus the LocalSessionFactoryBean that is seen in most spring tutorials.

To use the teneo approach, you need to define your beans and DAOs like the following:

<!-- Should get persistence properties and hibernate properties from property files. -->
    <bean id="sessionFactory" scope="singleton" lazy-init="true"
        <property name="EPackageClasses">
    <util:constant static-field="org.yourmodel.YourFactory.eINSTANCE"/>
    <bean id="contactDao" scope="singleton" lazy-init="true"
    <bean id="transactionManager"
        <property name="sessionFactory" ref="sessionFactory" />
You can access the eINSTANCE through the interface directly. There are other methods to get access to the instance and give it a shorter bean name using FieldRetrievingFactoryBean (or something like that). Do not forget your namespace definitions on the beans element.

Another way to create beans, especially if you have alot of them, is to create your own spring context local copy of the factory using

<bean id="yourFactory"

And then use

<bean id="yourNewBean" factory-bean="yourFactory" factory-method="createYourBean" />

where createYourBean is following the creator approach implemented by EMF.

Popular posts from this blog

React, Redux, Recompose and some simple steps to remove "some" boilerplate and improve reuse

graphql (facebook), falcor (netflix) and odata and ...

cats/cats-effect and webservices function composition