Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Stardust/Knowledge Base/Integration/Data/Hibernate Data Examples

< Stardust‎ | Knowledge Base‎ | Integration‎ | Data
Revision as of 15:01, 12 November 2011 by Unnamed Poltroon (Talk)

Hibernate Data Type Examples

Purpose

This article covers the Hibernate Data Type (one of the data types used in Modelling workbench), and uses audit trail database as datasource.

Requirements

  • Hibernate libraries
  • hibernate3.jar
  • Database client driver
  • derbyclient.jar
Preparation Create the table TESTUSER in the audittrail data source. Use the following SQL-Statement to do this.
CREATE TABLE testuser ( 
    id BIGINT NOT NULL,
   name VARCHAR(255),
   PRIMARY KEY (id)
 );

Configuration

carnot-spring-context.xml
...<br><!-- deactivate the common CARNOT-TXManager<br> <bean id="carnotTxManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"><br> <property name="dataSource"><br> <ref bean="carnotAuditTrailDataSource" /><br> </property><br> </bean><br>-->
 
<!-- create a new hibernate based TXManager --><br> <bean id="carnotTxManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"><br> <property name="sessionFactory"><br> <ref local="hibernateSessionFactory" /><br> </property><br> </bean>
 
...
 
<!-- create a hibernate session factory --><br> <!-- using the audittrail database as datasource and use a separat hibernate configuration file --><br> <bean id="hibernateSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><br> <property name="dataSource" ref="carnotAuditTrailDataSource" /><br> <property name="configLocation" value="classpath:/hibernate.cfg.xml" /><br> </bean><br><br><br>

Back to the top