Class HibernateDataSource

java.lang.Object
com.isomorphic.base.Base
All Implemented Interfaces:
com.isomorphic.base.IAutoConfigurable, com.isomorphic.datasource.Committable, com.isomorphic.datasource.FreeResourcesHandler, com.isomorphic.datasource.IType, com.isomorphic.interfaces.IHibernateDataSource, IToJSON, Serializable

public class HibernateDataSource extends BasicDataSource implements com.isomorphic.interfaces.IHibernateDataSource
A DataSource implementation for the Hibernate ORM system. SmartClient Server can integrate with Hibernate's ORM facilities, making use of new or existing bean mappings, or it can drive Hibernate as a pure storage layer in "beanless" mode. In this latter mode, SmartClient programs can connect to a Hibernate data store for all four CRUD operations, with zero server-side code or Hibernate configuration.

See the client reference documentation for details of configuring and using Hibernate DataSources - search for "hibernateIntegration". For a wider general discussion of data integration options with SmartClient Server, search the client documentation for "serverDataIntegration"

See Also:
  • Field Details

    • ESCAPE_CHARACTER

      public static final Character ESCAPE_CHARACTER
      Holds character ('~') used to escape wild cards in 'like' clause. Avoid using backslash '\' or dollar sign '$' because it is often used in databases as DB escape or wild card characters.
    • HB_CONFIG_PROPERTY

      public static final String HB_CONFIG_PROPERTY
      Name of the Hibernate configuration name property.
      See Also:
    • configName

      protected String configName
      Holds config name - can be configured with "jpaConfig" parameter. Holds empty string for default configuration.
    • relatedUpdates

      protected List<DSResponse> relatedUpdates
      Holds list of generated related updates. Usage: set this field to empty list before executing setProperties(); subsequent calls to setRelationFieldValue() will add DSResponse objects for every change in related data sources.
    • generateRelatedUpdates

      protected Boolean generateRelatedUpdates
      Holds value should related updates be generated. (Re)initialized on every execute() call. true - related updates will be generated; false - related updates will not be generated; null - related updates will be generated only for "add" and "update" operations, related updates will not be generated for "remove" operation.
    • additionalFields

      protected Map<String,DSField> additionalFields
      Holds list of additional fields requested by specific DSRequest.
  • Method Details

    • getFieldNames

      public List getFieldNames(boolean dropIgnored)
      Returns combined list of data source configured and request configured field names.
      Parameters:
      dropIgnored - boolean true - ignored fields are dropped; false - ignored fields are included;
      Returns:
      List field names.
    • getField

      public DSField getField(String fieldName)
      Returns DSField by specified name. First checks data source configured fields. Checks request configured fields if it is not found within data source configured fields. Returns null if fieldName parameter is null or field is not found.
      Overrides:
      getField in class BasicDataSource
      Parameters:
      fieldName - the name of the field whose definition you want
      Returns:
      DSField field.
      See Also:
    • escapeValueForFilter

      public static String escapeValueForFilter(Object value, char escapeChar)
      Escapes characters "_" and "%" with specified character in value object. Specified escape character is escped (doubled) as well. Empty string is returned if value object is null.
      Parameters:
      value - Object Value which should be escaped.
      escapeChar - char ecape character.
      Returns:
      String Escaped string value.
    • startTransaction

      public static org.hibernate.Transaction startTransaction() throws Exception
      Deprecated.
      As of SmartClient 8.0. Use HibernateTransaction.startTransaction(com.isomorphic.datasource.DSTransaction) instead
      Start a new transaction. The transaction ends when either commitTransaction(org.hibernate.Transaction) orrollbackTransaction(org.hibernate.Transaction) is called for the transaction.
      Returns:
      the new transaction
      Throws:
      Exception
    • rollbackTransaction

      public static void rollbackTransaction(org.hibernate.Transaction trx) throws Exception
      Deprecated.
      As of SmartClient 8.0. Use HibernateTransaction.rollbackTransaction(com.isomorphic.datasource.DSTransaction) instead
      Rollback and clean up the supplied transaction
      Throws:
      Exception - if problems were found rolling back the transaction
    • commitTransaction

      public static void commitTransaction(org.hibernate.Transaction trx) throws Exception
      Deprecated.
      As of SmartClient 8.0. Use HibernateTransaction.commitTransaction(com.isomorphic.datasource.DSTransaction) instead
      Commit and clean up the supplied transaction.
      Throws:
      Exception - if problems were found committing the transaction