Package org.exoplatform.services.database.annotation

Examples of org.exoplatform.services.database.annotation.Table.field()


   public void mapResultSet(ResultSet resultSet, T bean) throws Exception
   {
      Class<? extends DBObject> clazz = bean.getClass();
      Table table = clazz.getAnnotation(Table.class);
      TableField[] tableFields = table.field();

      ResultSetMetaData rsmd = resultSet.getMetaData();
      int numberOfColumns = rsmd.getColumnCount();
      for (int i = 1; i <= numberOfColumns; i++)
      {
View Full Code Here


   public void mapUpdate(T bean, PreparedStatement statement) throws Exception
   {
      Class<? extends DBObject> clazz = bean.getClass();
      Table table = clazz.getAnnotation(Table.class);
      TableField[] tableFields = table.field();

      int i = 1;
      for (TableField tableField : tableFields)
      {
         String fieldName = tableField.field().length() == 0 ? tableField.name() : tableField.field();
View Full Code Here

   }

   public <T extends DBObject> String createSelectQuery(Class<T> type, long id) throws Exception
   {
      Table table = type.getAnnotation(Table.class);
      TableField[] fields = table.field();

      StringBuilder query = new StringBuilder("SELECT ");
      for (int i = 0; i < fields.length; i++)
      {
         TableField field = fields[i];
View Full Code Here

   }

   public <T extends DBObject> String createUpdateQuery(Class<T> type) throws Exception
   {
      Table table = type.getAnnotation(Table.class);
      TableField[] fields = table.field();

      StringBuilder query = new StringBuilder("UPDATE ").append(table.name()).append(" SET ");
      for (int i = 0; i < fields.length; i++)
      {
         TableField field = fields[i];
View Full Code Here

   }

   public <T extends DBObject> String createInsertQuery(Class<T> type) throws Exception
   {
      Table table = type.getAnnotation(Table.class);
      TableField[] fields = table.field();

      StringBuilder query = new StringBuilder("INSERT INTO ").append(table.name()).append("(ID, ");
      for (int i = 0; i < fields.length; i++)
      {
         TableField field = fields[i];
View Full Code Here

   }

   public <T extends DBObject> String createUpdateQuery(Class<T> type, long id) throws Exception
   {
      Table table = type.getAnnotation(Table.class);
      TableField[] fields = table.field();

      StringBuilder query = new StringBuilder("UPDATE ").append(table.name()).append(" SET ");
      for (int i = 0; i < fields.length; i++)
      {
         TableField field = fields[i];
View Full Code Here

   }

   public <T extends DBObject> String createInsertQuery(Class<T> clazz, long id) throws Exception
   {
      Table table = clazz.getAnnotation(Table.class);
      TableField[] fields = table.field();

      StringBuilder query = new StringBuilder("INSERT INTO ").append(table.name()).append("(ID, ");
      for (int i = 0; i < fields.length; i++)
      {
         TableField field = fields[i];
View Full Code Here

         throw new Exception("Cannot find the annotation for class " + type.getClass().getName());
      }
      StringBuilder builder = new StringBuilder(1000);
      builder.append("CREATE TABLE ").append(table.name()).append(" (");
      appendId(builder);
      TableField[] fields = table.field();
      for (int i = 0; i < fields.length; i++)
      {
         TableField field = fields[i];
         String fieldType = field.type();
         if ("string".equals(fieldType))
View Full Code Here

         throw new Exception("Cannot find the annotation for class " + type.getClass().getName());
      }
      StringBuilder builder = new StringBuilder(1000);
      builder.append("CREATE TABLE ").append(table.name()).append(" (");
      appendId(builder);
      TableField[] fields = table.field();
      for (int i = 0; i < fields.length; i++)
      {
         TableField field = fields[i];
         String fieldType = field.type();
         if ("string".equals(fieldType))
View Full Code Here

   public void mapResultSet(ResultSet resultSet, T bean) throws Exception
   {
      Class<? extends DBObject> clazz = bean.getClass();
      Table table = clazz.getAnnotation(Table.class);
      TableField[] tableFields = table.field();

      ResultSetMetaData rsmd = resultSet.getMetaData();
      int numberOfColumns = rsmd.getColumnCount();
      for (int i = 1; i <= numberOfColumns; i++)
      {
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.