Java Code Examples for org.hibernate.mapping.Column#setName()

The following examples show how to use org.hibernate.mapping.Column#setName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HibernatePropertyParser.java    From mPaaS with Apache License 2.0 5 votes vote down vote up
/**
 * 构造列
 */
private Column buildColumn(String name, int len, SimpleValue value,
						   Table table) {
	Column column = new Column();
	column.setName(name);
	column.setLength(len);
	table.addColumn(column);
	value.addColumn(column);
	return column;
}
 
Example 2
Source File: OneToOneSecondPass.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Builds the <code>Join</code> instance for the mapped by side of a <i>OneToOne</i> association using 
 * a join tables.
 * <p>
 * Note:<br/>
 * <ul>
 * <li>From the mappedBy side we should not create the PK nor the FK, this is handled from the other side.</li>
 * <li>This method is a dirty dupe of EntityBinder.bindSecondaryTable</i>.
 * </p>
 */
private Join buildJoinFromMappedBySide(PersistentClass persistentClass, Property otherSideProperty, Join originalJoin) {
	Join join = new Join();
	join.setPersistentClass( persistentClass );

	//no check constraints available on joins
	join.setTable( originalJoin.getTable() );
	join.setInverse( true );
	SimpleValue key = new DependantValue( buildingContext, join.getTable(), persistentClass.getIdentifier() );
	//TODO support @ForeignKey
	join.setKey( key );
	join.setSequentialSelect( false );
	//TODO support for inverse and optional
	join.setOptional( true ); //perhaps not quite per-spec, but a Good Thing anyway
	key.setCascadeDeleteEnabled( false );
	Iterator mappedByColumns = otherSideProperty.getValue().getColumnIterator();
	while ( mappedByColumns.hasNext() ) {
		Column column = (Column) mappedByColumns.next();
		Column copy = new Column();
		copy.setLength( column.getLength() );
		copy.setScale( column.getScale() );
		copy.setValue( key );
		copy.setName( column.getQuotedName() );
		copy.setNullable( column.isNullable() );
		copy.setPrecision( column.getPrecision() );
		copy.setUnique( column.isUnique() );
		copy.setSqlType( column.getSqlType() );
		copy.setCheckConstraint( column.getCheckConstraint() );
		copy.setComment( column.getComment() );
		copy.setDefaultValue( column.getDefaultValue() );
		key.addColumn( copy );
	}
	persistentClass.addJoin( join );
	return join;
}