Package jodd.db.oom

Examples of jodd.db.oom.DbOomManager.lookupType()


   * Foreign key is created by concatenating foreign table name and column name.
   */
  public static DbSqlBuilder findForeign(Class entity, Object value) {
    String tableRef = createTableRefName(entity);
    DbOomManager dbOomManager = DbOomManager.getInstance();
    DbEntityDescriptor dedFk = dbOomManager.lookupType(value.getClass());

    String tableName = dbOomManager.getTableNames().convertTableNameToEntityName(dedFk.getTableName());
    String columnName = dbOomManager.getColumnNames().convertColumnNameToPropertyName(dedFk.getIdColumnName());

    String fkColumn = uncapitalize(tableName) + capitalize(columnName);
View Full Code Here


   * Otherwise, entity will be inserted into the database.
   */
  public <E> E store(E entity) {
    DbOomManager dboom = DbOomManager.getInstance();
    Class type = entity.getClass();
    DbEntityDescriptor ded = dboom.lookupType(type);

    if (ded == null) {
      throw new DbOomException("Not an entity: " + type);
    }
    if (isPersistent(ded, entity) == false) {
View Full Code Here

      if (result != 0) {
        // now reset the ID value
        DbOomManager dboom = DbOomManager.getInstance();
        Class type = entity.getClass();
        DbEntityDescriptor ded = dboom.lookupType(type);

        setEntityId(ded, entity, 0);
      }
    }
  }
View Full Code Here

  public synchronized long nextId(Class entityType) {
    MutableLong lastId = entityIdsMap.get(entityType);
    if (lastId == null) {
      DbOomManager dbOomManager = DbOomManager.getInstance();

      DbEntityDescriptor ded = dbOomManager.lookupType(entityType);
      String tableName = ded.getTableName();
      String idColumn = ded.getIdColumnName();

      DbOomQuery dbOomQuery = query("select max(" + idColumn + ") from " + tableName);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.