org.mentabean.jdbc
Class H2BeanSession

java.lang.Object
  extended by org.mentabean.jdbc.AnsiSQLBeanSession
      extended by org.mentabean.jdbc.H2BeanSession
All Implemented Interfaces:
BeanSession

public class H2BeanSession
extends AnsiSQLBeanSession

H2 supports AUTOINCREMENT and SEQUENCE fields. Now has the value 'sysdate', like Oracle.

Author:
Sergio Oliveira Jr.

Nested Class Summary
 
Nested classes/interfaces inherited from class org.mentabean.jdbc.AnsiSQLBeanSession
AnsiSQLBeanSession.QueryAndValues, AnsiSQLBeanSession.Value
 
Field Summary
 
Fields inherited from class org.mentabean.jdbc.AnsiSQLBeanSession
beanManager, conn, DEBUG, DEBUG_NATIVE, dispatcher, loaded
 
Fields inherited from interface org.mentabean.BeanSession
INSERT, UPDATE
 
Constructor Summary
H2BeanSession(BeanManager beanManager, Connection conn)
           
 
Method Summary
protected  String getCurrentTimestampCommand()
          Get the command representing 'now' in this database.
protected  String getDatabaseType(DBType<?> dbType)
          Each dialect can override this to return the database column type it supports other than the ANSI standard.
protected  StringBuilder handleLimit(StringBuilder sb, OrderBy orderBy, Limit limit)
          Some databases will sort before applying the limit (MySql), others will not (Oracle).
 void insert(Object bean)
          Insert the bean in the database.
protected  boolean isVarcharUnlimitedSupported()
          Each dialect can override this to return true if the VARCHAR type supports unlimited size
 
Methods inherited from class org.mentabean.jdbc.AnsiSQLBeanSession
addTrigger, bindToInsertStatement, buildQuery, buildSelect, buildSelect, buildSelect, buildSelect, buildSelectImpl, buildSelectMinus, buildSelectMinus, buildTableName, countList, createBasicInstance, createPKConstraintQuery, createTable, createTableAlias, createTableAlias, createTables, debugNativeSql, debugSql, delete, dispatchAfterDelete, dispatchAfterInsert, dispatchAfterUpdate, dispatchBeforeDelete, dispatchBeforeInsert, dispatchBeforeUpdate, dispatchTrigger, dropTable, getConfigFor, getConnection, getProperties, getPropertyBean, getValueFromBean, getValueFromBean, injectValue, isSet, load, load, loadImpl, loadList, loadList, loadList, loadList, loadList, loadList, loadList, loadList, loadListMinus, loadListMinus, loadListMinus, loadListMinus, loadMinus, loadUnique, loadUnique, loadUniqueImpl, loadUniqueMinus, populateBean, populateBean, populateBean, populateBean, populateBeanImpl, populateBeanMinus, populateBeanMinus, prepareInsertQuery, propertyToColumn, propertyToColumn, propertyToColumn, removeTrigger, save, save, saveAll, update, updateAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

H2BeanSession

public H2BeanSession(BeanManager beanManager,
                     Connection conn)
Method Detail

getCurrentTimestampCommand

protected String getCurrentTimestampCommand()
Description copied from class: AnsiSQLBeanSession
Get the command representing 'now' in this database. This base implementation returns null, in other words, no now command will be used.

Overrides:
getCurrentTimestampCommand in class AnsiSQLBeanSession
Returns:
the command for now in this database (now(), sysdate, etc)

handleLimit

protected StringBuilder handleLimit(StringBuilder sb,
                                    OrderBy orderBy,
                                    Limit limit)
Description copied from class: AnsiSQLBeanSession
Some databases will sort before applying the limit (MySql), others will not (Oracle). Handle each one accordingly. Note: This base implementation does nothing.

Overrides:
handleLimit in class AnsiSQLBeanSession
Returns:
A string builder with the the SQL modified for the limit operation

getDatabaseType

protected String getDatabaseType(DBType<?> dbType)
Description copied from class: AnsiSQLBeanSession
Each dialect can override this to return the database column type it supports other than the ANSI standard.

Overrides:
getDatabaseType in class AnsiSQLBeanSession
Returns:
The string representation of this database type to be used with create table statement

insert

public void insert(Object bean)
Description copied from interface: BeanSession
Insert the bean in the database. Depending on the type of PK, the generation of the PK can and should be taken care by the DB itself. The generated PK should be inserted in the bean by reflection, before the method returns. The default, database-independent implementation of this method, insert all fields in the database not worrying about PK generation strategies.

Specified by:
insert in interface BeanSession
Overrides:
insert in class AnsiSQLBeanSession
Parameters:
bean - The bean to insert

isVarcharUnlimitedSupported

protected boolean isVarcharUnlimitedSupported()
Description copied from class: AnsiSQLBeanSession
Each dialect can override this to return true if the VARCHAR type supports unlimited size

Overrides:
isVarcharUnlimitedSupported in class AnsiSQLBeanSession
Returns:
true if database supports VARCHAR with no limit, false otherwise


Copyright © 2013. All Rights Reserved.