aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/healthmarketscience/jackcess/RelationshipBuilder.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/com/healthmarketscience/jackcess/RelationshipBuilder.java b/src/main/java/com/healthmarketscience/jackcess/RelationshipBuilder.java
index 8ba9bb1..e52ea80 100644
--- a/src/main/java/com/healthmarketscience/jackcess/RelationshipBuilder.java
+++ b/src/main/java/com/healthmarketscience/jackcess/RelationshipBuilder.java
@@ -59,8 +59,11 @@ public class RelationshipBuilder
private List<String> _fromCols = new ArrayList<String>();
private List<String> _toCols = new ArrayList<String>();
- public RelationshipBuilder(String fromTable, String toTable)
- {
+ public RelationshipBuilder(Table fromTable, Table toTable) {
+ this(fromTable.getName(), toTable.getName());
+ }
+
+ public RelationshipBuilder(String fromTable, String toTable) {
_fromTable = fromTable;
_toTable = toTable;
}
@@ -75,6 +78,13 @@ public class RelationshipBuilder
}
/**
+ * Adds a pair of columns to the relationship.
+ */
+ public RelationshipBuilder addColumns(Column fromCol, Column toCol) {
+ return addColumns(fromCol.getName(), toCol.getName());
+ }
+
+ /**
* Enables referential integrity enforcement for this relationship.
*
* Note, this requires the "from" table to have an existing unique index on