mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-10 13:14:50 +00:00
HHH-7031 TableSpecification.locateForeignKey impl
This commit is contained in:
parent
c134154f59
commit
a096b1c874
@ -59,7 +59,7 @@ public Iterable<SimpleValue> values() {
|
||||
|
||||
@Override
|
||||
public Column locateOrCreateColumn(String name) {
|
||||
if(values.containsKey( name )){
|
||||
if ( values.containsKey( name ) ) {
|
||||
return (Column) values.get( name );
|
||||
}
|
||||
final Column column = new Column( this, values.size(), name );
|
||||
@ -69,7 +69,7 @@ public Column locateOrCreateColumn(String name) {
|
||||
|
||||
@Override
|
||||
public DerivedValue locateOrCreateDerivedValue(String fragment) {
|
||||
if(values.containsKey( fragment )){
|
||||
if ( values.containsKey( fragment ) ) {
|
||||
return (DerivedValue) values.get( fragment );
|
||||
}
|
||||
final DerivedValue value = new DerivedValue( this, values.size(), fragment );
|
||||
@ -94,6 +94,31 @@ public ForeignKey createForeignKey(TableSpecification targetTable, String name)
|
||||
return fk;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForeignKey locateForeignKey(String name) {
|
||||
for ( ForeignKey fk : foreignKeys ) {
|
||||
if ( fk.getName().equals( name ) ) {
|
||||
return fk;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<ForeignKey> locateForeignKey(TableSpecification targetTable) {
|
||||
List<ForeignKey> result = null;
|
||||
for ( ForeignKey fk : foreignKeys ) {
|
||||
if ( fk.getTargetTable().equals( targetTable ) ) {
|
||||
if ( result == null ) {
|
||||
result = new ArrayList<ForeignKey>();
|
||||
}
|
||||
result.add( fk );
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PrimaryKey getPrimaryKey() {
|
||||
return primaryKey;
|
||||
|
@ -86,6 +86,7 @@ public Iterable<Index> getIndexes() {
|
||||
return indexes.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Index getOrCreateIndex(String name) {
|
||||
if( indexes.containsKey( name ) ){
|
||||
return indexes.get( name );
|
||||
@ -100,6 +101,7 @@ public Iterable<UniqueKey> getUniqueKeys() {
|
||||
return uniqueKeys.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UniqueKey getOrCreateUniqueKey(String name) {
|
||||
if( uniqueKeys.containsKey( name ) ){
|
||||
return uniqueKeys.get( name );
|
||||
@ -109,6 +111,7 @@ public UniqueKey getOrCreateUniqueKey(String name) {
|
||||
return uniqueKey;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Iterable<CheckConstraint> getCheckConstraints() {
|
||||
return checkConstraints;
|
||||
|
Loading…
x
Reference in New Issue
Block a user