Hibernate ORM Column - 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 Column class.

This code example shows how to use the following methods: equals, getCanonicalName, isUnique
		assertNotNull(uniqueKey);
		 
		assertEquals(1, uniqueKey.getColumnSpan() );
		 
		Column keyCol = uniqueKey.getColumn(0);
		assertTrue(keyCol.isUnique() );
		 
		assertSame(keyCol, table.getColumn(keyCol) );
		 
	} 
	 
	public void testWithIndex() { 
		 
		Table table = getTable(identifier("withIndex") );
		 
		assertEqualIdentifiers("withIndex", table.getName() );
		 
		assertNull("there should be no pk", table.getPrimaryKey() );
		Iterator iterator = table.getIndexIterator();
	 

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: equals, getCanonicalName
		 
		assertFalse("should only be one fk", iterator.hasNext() );
		 
		assertEquals(1, fk.getColumnSpan() );
		 
		assertSame(fk.getColumn(0), child.getColumn(new Column(identifier("masterref") ) ) );
		 
		 
	} 
 
	 
	 
	 
	public void testExport() { 
		 
		new SchemaExport(cfg).create(true, false);
		 
	} 
	 
	public static Test suite() {

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: equals, getCanonicalName
 
	public void testScalePrecisionLength() { 
 
		Table table = getTable( identifier( "basic" ) );
 
		Column nameCol = table.getColumn( new Column( identifier( "name" ) ) );
		assertEquals( nameCol.getLength(), 20 );
		assertEquals( nameCol.getPrecision(), Column.DEFAULT_PRECISION );
		assertEquals( nameCol.getScale(), Column.DEFAULT_SCALE );
	} 
 
	/* 
	 * public void testGetTables() { 
	 *  
	 * Table table = new Table(); table.setName("dummy"); cfg.addTable(table); 
	 *  
	 * Table foundTable = cfg.getTable(null,null,"dummy"); 
	 *  
	 * assertSame(table,foundTable); 
	 *  

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: equals, getCanonicalName
 
	public void testScalePrecisionLength() { 
 
		Table table = getTable( identifier( "basic" ) );
 
		Column nameCol = table.getColumn( new Column( identifier( "name" ) ) );
		assertEquals( nameCol.getLength(), 20 );
		assertEquals( nameCol.getPrecision(), Column.DEFAULT_PRECISION );
		assertEquals( nameCol.getScale(), Column.DEFAULT_SCALE );
	} 
 
	/* 
	 * public void testGetTables() { 
	 *  
	 * Table table = new Table(); table.setName("dummy"); cfg.addTable(table); 
	 *  
	 * Table foundTable = cfg.getTable(null,null,"dummy"); 
	 *  
	 * assertSame(table,foundTable); 
	 *  

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: getLength, getName, getPrecision, getScale, getSqlType
			annotations.append("@").append( importType("org.hibernate.annotations.Formula") )
					.append("(value=\"" ).append( selectable.getText() ).append( "\")" );
		} 
		else { 
			Column column = (Column) selectable;
			annotations.append( "@" + importType("javax.persistence.Column") + "(name=\"" ).append( column.getName() ).append( "\"" );
			 
			appendCommonColumnInfo( annotations, column, insertable, updatable );
			 
			if (column.getPrecision() != Column.DEFAULT_PRECISION) { // the default is actually 0 in spec
				annotations.append( ", precision=" ).append( column.getPrecision() );
			} 
			if (column.getScale() != Column.DEFAULT_SCALE) { // default is actually 0 in spec
				annotations.append( ", scale=" ).append( column.getScale() );
			} 
			else if (column.getLength() != 255){ 
				annotations.append( ", length=" ).append( column.getLength() );
			} 
			 
					 

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: equals, getCanonicalName
 
	public void testScalePrecisionLength() { 
 
		Table table = getTable( identifier( "basic" ) );
 
		Column nameCol = table.getColumn( new Column( identifier( "name" ) ) );
		assertEquals( nameCol.getLength(), 20 );
		assertEquals( nameCol.getPrecision(), Column.DEFAULT_PRECISION );
		assertEquals( nameCol.getScale(), Column.DEFAULT_SCALE );
	} 
 
	 
/*	public void testAutoDetectSingleSchema() { 
		 
		//read single schema without default schema: result = no schema info in tables. 
		JDBCMetaDataConfiguration mycfg = new JDBCMetaDataConfiguration(); 
		mycfg.setReverseEngineeringStrategy(new DelegatingReverseEngineeringStrategy(new DefaultReverseEngineeringStrategy()) { 
			public boolean excludeTable(TableIdentifier ti) { 
				return !"PUBLIC".equals(ti.getSchema());				 
			} 

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: setValue
        assertNotNull(todaysDate);
        log.debug("today's date: " + todaysDate);
    } 
 
    private Column createColumn(Class clazz) {
        Column column = new Column();
        SimpleValue sv = new SimpleValue();
        sv.setTypeName(clazz.getName());
        column.setValue(sv);
        return column;
    } 
} 
Full Snippet Info
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: equals, getCanonicalName
 
	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: getSqlType
                .getKey() 
                .getColumnIterator(); 
        childEntityKeyColumnsIterator.next();
        Column second = (Column) childEntityKeyColumnsIterator.next();
 
        assertEquals(second.getSqlType(), "int");
    } 
} 
Full Snippet Info
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
	} 
 
	private boolean hasReference(Column column, Column ref) {
		String refName = (String) references.get(column.getName().toLowerCase());
		return ref.getName().equalsIgnoreCase(refName);
	} 
 
	public boolean matches(ForeignKey fk) {
		if ( refTable.equalsIgnoreCase( fk.getReferencedTable().getName() ) ) {
			if ( fk.getColumnSpan() == references.size() ) {
				List fkRefs;
				if ( fk.isReferenceToPrimaryKey() ) {
					fkRefs = fk.getReferencedTable().getPrimaryKey().getColumns();
				} 
				else { 
					fkRefs = fk.getReferencedColumns();
				} 
				for ( int i = 0; i < fk.getColumnSpan(); i++ ) {
					Column column = fk.getColumn( i );
					Column ref = ( Column ) fkRefs.get( i );
Full Snippet Info
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java