org.mentabean.jdbc
Class MySQLBeanSession
java.lang.Object
org.mentabean.jdbc.JdbcBeanSession
org.mentabean.jdbc.MySQLBeanSession
- All Implemented Interfaces:
- BeanSession
public class MySQLBeanSession
- extends JdbcBeanSession
MySQL only supports auto-increment.
Now in mysql is 'now()'
- Author:
- soliveira
| Methods inherited from class org.mentabean.jdbc.JdbcBeanSession |
buildSelect, buildSelect, buildSelectMinus, buildSelectMinus, countList, debugSql, delete, getConnection, getValueFromBean, getValueFromBean, injectValue, isSet, load, loadList, loadList, loadList, loadList, loadListMinus, loadListMinus, loadListMinus, loadListMinus, loadUnique, populateBean, populateBean, populateBeanMinus, populateBeanMinus, update, updateAll |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MySQLBeanSession
public MySQLBeanSession(BeanManager beanManager,
Connection conn)
getNow
protected String getNow()
- Description copied from class:
JdbcBeanSession
- Get the command representing 'now' in this database. This base implementation returns null, in other words, no now command will be used.
- Overrides:
getNow in class JdbcBeanSession
- Returns:
- the command for now in this database (now(), sysdate, etc)
handleLimit
protected StringBuilder handleLimit(StringBuilder sb,
String orderBy,
int limit)
- MySQL is not like Oracle. It will SORT everything first and then apply LIMIT.
- Overrides:
handleLimit in class JdbcBeanSession
- Returns:
- A string builder with the the SQL modified for the limit operation
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 JdbcBeanSession
- Parameters:
bean - The bean to insert
Copyright © 2011. All Rights Reserved.