Package javax.persistence

Examples of javax.persistence.Table


          // Table
          boolean isMatched = false;
          String tabName = "";
          for (Annotation ann : clazz.getAnnotations()) {
            if (ann instanceof Table) {
              Table tab = (Table) ann;
              tabName = tab.name();
              // check table whether in config list
              if (tabName != null) {
                if (HpCommonConfig.tables.contains(tabName.toUpperCase())) {
                  isMatched = true;
                } else {
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 = super.getAnnotation( 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

    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

        }
    }

    private void putTableDeclaration(AnnotationInfo ai, Class<?> c)
  {
      Table table = c.getAnnotation(Table.class);
      if(table != null)
      {
        if(table.name() == null)
          throw new PersistenceException("You must specify a name= for @Table on " + c.getName());
       
        ai.setDomainName(table.name());
      }
  }
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

      //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

      //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

    @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

      //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

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.