Hibernate ORM Table - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM Table class.

This code example shows how to use the following methods:setAbstract, setCatalog, setName, setSchema
This code example shows how to use the following methods:getCatalog, getName, getSchema
		if (left==null || right==null) return false;
		return left.equals(right);
	} 
	 
	public static TableIdentifier create(Table table) {
		return new TableIdentifier(table.getCatalog(), table.getSchema(), table.getName() );
	} 
	 
	public String toString() {
		StringBuffer buf = new StringBuffer()
					.append( "TableIdentifier" )
					.append('(');
		if ( getCatalog()!=null ) buf.append( getCatalog() + "." );
		if ( getSchema()!=null ) buf.append( getSchema()+ ".");
		buf.append( getName() ).append(')');
		return buf.toString();
	} 
	 
} 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getCatalog, getName, getSchema
	public void testOverlapping() { 
		 
		JDBCMetaDataConfiguration configuration = new JDBCMetaDataConfiguration();
		 
		OverrideRepository or = new OverrideRepository();
		or.addSchemaSelection(new SchemaSelection(null, "OVRTEST"));
		or.addSchemaSelection(new SchemaSelection(null, null));
		configuration.setReverseEngineeringStrategy(or.getReverseEngineeringStrategy(new DefaultReverseEngineeringStrategy()));
		configuration.readFromJDBC();
		 
		Set tables = new HashSet();
		Iterator iter = configuration.getTableMappings();
		while(iter.hasNext()) {
			Table element = (Table) iter.next();
			boolean added = tables.add(TableIdentifier.create(element));
			if(!added) fail("duplicate table found for " + element); 
		} 
		 
		assertEquals(4,tables.size());					
	} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getQualifiedName, sqlDropString
    return DriverManager.getConnection(
        _tool.getDbServerHost() + "/" + _tool.getTestCatalog(), _tool.getUser(), _tool.getPassword());
  } 
 
  private void createTestTable() throws SQLException {
    Table table = new Table(TEST_TABLE);
    try { 
      String dropSql = table.sqlDropString(_tool.getHibernateDialect(), null, _tool
          .getTestSchema()); 
      _tool.executeSql(_tool.getTestCatalog(), _tool.getTestSchema(), dropSql);
    } catch (OpenGammaRuntimeException e) {
      // It might not exist, that's OK 
    } 
    String createSql = "CREATE TABLE "
        + table.getQualifiedName(_tool.getHibernateDialect(), null, _tool
            .getTestSchema()) + " (test_column char(50))"; 
    _tool.executeSql(_tool.getTestCatalog(), _tool.getTestSchema(), createSql);
  } 
 
} 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getCatalog, getName, getSchema
		 
		if(catchild.getName().equals(TABLE2)) {
			catchild = (Table) tables.get(1);
			catmaster = (Table) tables.get(0);
		}  
			 
		TableIdentifier masterid = TableIdentifier.create(catmaster);
		TableIdentifier childid = TableIdentifier.create(catchild);
		 
		assertEquals(new TableIdentifier(null, SCHEMA, TABLE1), childid);
		assertEquals(new TableIdentifier(null, SCHEMA, TABLE2), masterid);
	} 
	 
	public void testNeedQuote() { 
		Settings buildSettings = cfg.buildSettings();
		ServiceRegistry serviceRegistry = cfg.getServiceRegistry();
				 
		MetaDataDialect realMetaData = JDBCReaderFactory.newMetaDataDialect( serviceRegistry.getService(JdbcServices.class).getDialect(), cfg.getProperties() );
		assertTrue("The name must be quoted!", realMetaData.needQuote(SCHEMA));
		assertTrue("The name must be quoted!", realMetaData.needQuote(TABLE1));
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getCatalog, getName, getSchema
			// log?			 
		} 
	} 
 
	String table(Table t) {
		return Table.qualify( t.getCatalog(), t.getSchema(), t.getName() );
	} 
	 
	public void visit(Configuration cfg, Table table, Column col,
			IssueCollector pc) {
		if ( currentDbTable == null ) {
			return; 
		} 
 
		Column dbColumn = currentDbTable
				.getColumn( new Column( col.getName() ) );
 
		if ( dbColumn == null ) {
			pc.reportIssue( new Issue( "SCHEMA_COLUMN_MISSING",
					Issue.HIGH_PRIORITY, table(table) + " is missing column: " + col.getName() ) );
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setCatalog, setName, setSchema
			if(foreignTableName!=null) {
				List localColumns = new ArrayList();
				localColumns.add(column);
				List foreignColumns = new ArrayList();
				 
				Table foreignTable = new Table();
				foreignTable.setName(foreignTableName);
				foreignTable.setCatalog(getValue(element.attributeValue( "foreign-catalog"),table.getCatalog()) );
				foreignTable.setSchema(getValue(element.attributeValue( "foreign-schema"), table.getSchema()) );
				 
				String foreignColumnName = element.attributeValue("foreign-column");
				if(foreignColumnName!=null) {
					Column foreignColumn = new Column();
					foreignColumn.setName(foreignColumnName);
					foreignColumns.add(foreignColumn);
				}  
				else { 
					throw new MappingException("foreign-column is required when foreign-table is specified on " + column);
				} 
				 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getColumn, getOrCreateIndex, getOrCreateUniqueKey
 
	private void addConstraintToColumn(String columnName) {
		Column column = table.getColumn(
				new Column(
						mappings.getPhysicalColumnName( columnName, table )
				) 
		); 
		if ( column == null ) {
			throw new AnnotationException(
					"@Index references a unknown column: " + columnName
			); 
		} 
		if ( unique )
			table.getOrCreateUniqueKey( indexName ).addColumn( column );
		else 
			table.getOrCreateIndex( indexName ).addColumn( column );
	} 
} 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getCatalog, getName, getSchema
	    	} 
	    	 
	    } 
 
	    private boolean equalTable(Table table1, Table table2) {
			return  table1.getName().equals(table2.getName()) 
					&& ( equal(table1.getSchema(), table2.getSchema() )
					&& ( equal(table1.getCatalog(), table2.getCatalog() ) ) );
		} 
 
		private boolean equal(String str, String str2) {
			if(str==str2) return true;
			if(str!=null && str.equals(str2) ) return true;
			return false; 
		} 
 
		static private void addToMultiMap(Map multimap, String key, Object item) {
			List existing = (List) multimap.get(key);
			if(existing == null) {
				existing = new ArrayList();
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getName
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java