public interface HibernateIntegration
schemaBeanto derive from the bean or
DataSource.autoDeriveSchemato derive from the mapping. In this case you will initially have a very short .ds.xml per bean - no <fields> are required unless and until you want to override the automatically derived fields.
Which mode to use is primarily a matter of preference and pre-existing code. However, if you do not have pre-existing code or other special circumstances, the following approach is the most productive:
Note that the
Admin Console's "Import DataSources" section can be used to import test data into serverType:"hibernate" DataSources in the same manner as SQLDataSources.
HibernateDataSource supports operations with composite primary keys. Setting data source level property
idClassName to fully qualified class name indicates, that entity uses composite primary key.
For Hibernate integration where Java beans have been explicitly declared, HibernateDataSource supports automatic handling of Hibernate relations that don't declare a concrete field to hold ID values - see
You can provide Hibernate configuration to the Smart GWT server in three ways:
hibernate.cfg.xmlfile somewhere on the classpath
Configurationto use. This works in the same way as a
ServerObject, and in fact makes use of the ServerObject code, though note that lookupStyle "attribute" is not supported. To look up a configuration, add ServerObject-compliant properties to your
server.propertiesfile, prefixed with
hibernate.config. For example:
hibernate.config.lookupStyle: spring hibernate.config.bean: mySessionFactory
configBeanon the dataSource (this is only applicable if you are using Spring; see below)
lookupStyleof "spring", Smart GWT will make use of a Hibernate
SessionFactoryconfigured by Spring. It is possible to set up multiple Hibernate configurations in Spring, and to map individual DataSources to different configurations by making use of the
dataSource.configBeanproperty mentioned above. Please note the following caveats:
.cfg.xmlfile named in the Spring bean's
configLocationproperty, or by use of persistence annotations in the actual mapped beans themselves
In some cases you may not be able to immediately use the built-in HibernateDataSource - in this case take a look at
manual Hibernate integration.