Package javax.persistence

Examples of javax.persistence.Table


      //no element but might have some default or some annotation
      if ( StringHelper.isNotEmpty( defaults.getCatalog() )
          || StringHelper.isNotEmpty( defaults.getSchema() ) ) {
        AnnotationDescriptor annotation = new AnnotationDescriptor( Table.class );
        if ( defaults.canUseJavaAnnotations() ) {
          Table table = getJavaAnnotation( Table.class );
          if ( table != null ) {
            annotation.setValue( "name", table.name() );
            annotation.setValue( "schema", table.schema() );
            annotation.setValue( "catalog", table.catalog() );
            annotation.setValue( "uniqueConstraints", table.uniqueConstraints() );
            annotation.setValue( "indexes", table.indexes() );
          }
        }
        if ( StringHelper.isEmpty( (String) annotation.valueOf( "schema" ) )
            && StringHelper.isNotEmpty( defaults.getSchema() ) ) {
          annotation.setValue( "schema", defaults.getSchema() );
View Full Code Here


      //no element but might have some default or some annotation
      if ( StringHelper.isNotEmpty( defaults.getCatalog() )
          || StringHelper.isNotEmpty( defaults.getSchema() ) ) {
        AnnotationDescriptor annotation = new AnnotationDescriptor( Table.class );
        if ( defaults.canUseJavaAnnotations() ) {
          Table table = getJavaAnnotation( Table.class );
          if ( table != null ) {
            annotation.setValue( "name", table.name() );
            annotation.setValue( "schema", table.schema() );
            annotation.setValue( "catalog", table.catalog() );
            annotation.setValue( "uniqueConstraints", table.uniqueConstraints() );
          }
        }
        if ( StringHelper.isEmpty( (String) annotation.valueOf( "schema" ) )
            && StringHelper.isNotEmpty( defaults.getSchema() ) ) {
          annotation.setValue( "schema", defaults.getSchema() );
View Full Code Here

    @Override
    protected void handleJoinTarget(JoinExpression je) {
        SQLTemplates templates = getTemplates();
        Class<?> type = je.getTarget().getType();
        if (type.getAnnotation(Table.class) != null && templates.isSupportsAlias()) {
            Table table = type.getAnnotation(Table.class);
            boolean precededByDot;
            if (!table.schema().isEmpty() && templates.isPrintSchema()) {
                appendSchemaName(table.schema());
                append(".");
                precededByDot = true;
            } else {
                precededByDot = false;
            }
            appendTableName(table.name(), precededByDot);
            append(templates.getTableAlias());
        }
        super.handleJoinTarget(je);
    }
View Full Code Here

       
        return sts;
    }
   
    public static final String getTableName(Class<?> clazz) {
        Table table = clazz.getAnnotation(Table.class);
        return table != null ? table.name() : clazz.getSimpleName();
    }
View Full Code Here

    @DB()
    protected void setField(final Object entity, final ResultSet rs, ResultSetMetaData meta, final int index) throws SQLException {
        Attribute attr = _allColumns.get(new Pair<String, String>(meta.getTableName(index), meta.getColumnName(index)));
        if ( attr == null ){
            // work around for mysql bug to return original table name instead of view name in db view case
            Table tbl = entity.getClass().getSuperclass().getAnnotation(Table.class);
            if ( tbl != null ){
                attr = _allColumns.get(new Pair<String, String>(tbl.name(), meta.getColumnLabel(index)));
            }
        }
        assert (attr != null) : "How come I can't find " + meta.getCatalogName(index) + "." + meta.getColumnName(index);
        setField(entity, attr.field, rs, index);
    }
View Full Code Here

    sqlNameToParameter = ImmutableMap.copyOf(n);
    idParameters = ImmutableMap.copyOf(id);
    manyToOneParameters = ImmutableMap.copyOf(m);
    simpleParameters = ImmutableMap.copyOf(s);
   
    Table t = objectType.getAnnotation(Table.class);
    if (t != null && t.name() != null) {
      sqlName = t.name();
    }
    else {
      sqlName = config.getNamingStrategy().classToTableName(objectType.getSimpleName());
    }
  }
View Full Code Here

      Entity e = beanDescriptor.getAnnotation(Entity.class);
      if (ConditionUtils.isNotEmpty(e.name())) {
        entity.setAttribute("name", e.name());
      }

      Table t = beanDescriptor.getAnnotation(Table.class);
      if (t != null) {
        XmlElement table = entity.addElement("table");
        table.setAttribute("name", t.name());
        if (ConditionUtils.isNotEmpty(t.schema())) {
          table.setAttribute("schema", t.schema());
        }
      }

      XmlElement attributes = entity.addElement("attributes");
View Full Code Here

              && !clsName.endsWith("Model")) {
           
            return null;
          }
         
          Table tableAnn = clazz.getAnnotation(Table.class);
          String table = tableAnn == null ? "" :tableAnn.name();
          table = "".equals(table.trim()) ? clsName
              : table;
          ORMConfigBean ormBean = new ORMConfigBean();
          ormBean.setClazz(clazz.getName());
          ormBean.setId(clazz.getSimpleName());
View Full Code Here

    if (entity == null && !clsName.endsWith("PO")
        && !clsName.endsWith("POJO") && !clsName.endsWith("Entity")
        && !clsName.endsWith("Model")) {
      return;
    }
    Table tableAnn = clazz.getAnnotation(Table.class);
    String table = tableAnn == null ? "" : tableAnn.name();
    table = "".equals(table.trim()) ? clazz.getSimpleName()
        .replace("PO", "").replace("POJO", "").replace("Entity", "")
        .replace("Model", "") : table;
    ORMConfigBean ormBean = new ORMConfigBean();
    ormBean.setClazz(clazz.getName());
View Full Code Here

    if (entity == null && !clsName.endsWith("PO")
        && !clsName.endsWith("POJO") && !clsName.endsWith("Entity")
        && !clsName.endsWith("Model")) {
      return false;
    }
    Table tableAnn = clazz.getAnnotation(Table.class);
    String table = tableAnn == null ? "" : tableAnn.name();
    table = "".equals(table.trim()) ? clazz.getSimpleName()
        .replace("PO", "").replace("POJO", "").replace("Entity", "")
        .replace("Model", "") : table;
    ORMConfigBean ormBean = new ORMConfigBean();
    ormBean.setClazz(clazz.getName());
View Full Code Here

TOP

Related Classes of javax.persistence.Table

Copyright © 2018 www.massapicom. 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.