[hibernate-dev] [metamodel] why not just give a generated name to constraint if no one provided in the mapping?

Strong Liu stliu at hibernate.org
Thu Dec 13 06:12:23 EST 2012


talking about  org.hibernate.metamodel.spi.relational.AbstractConstraint#getName

proposing this :

	public String getName() {
		if ( name == null ) {
			name = getExportedName();
		}
		return name;
	}

reason:

I have to copy all the constraints defined in the root table to the sub table in a table-per-class hierarchy, w/o constraint name, it is hard to use "locate" methods, and I don't want to calculate  generatedName() method many times.


alternative:

we add a defaultName / internalName attribute to the constraint, and use it for the internal constraint look up, the value is generated when constraint object created

wdyt?

-------------------------
Best Regards,

Strong Liu <stliu at hibernate.org>
http://about.me/stliu/bio



More information about the hibernate-dev mailing list