1 19 20 21 package org.apache.cayenne.jpa.map; 22 23 import java.util.ArrayList ; 24 import java.util.Collection ; 25 26 import javax.persistence.SecondaryTable; 27 28 import org.apache.cayenne.util.TreeNodeChild; 29 30 public class JpaSecondaryTable extends JpaTable { 31 32 protected Collection <JpaPrimaryKeyJoinColumn> primaryKeyJoinColumns; 33 34 public JpaSecondaryTable() { 35 36 } 37 38 public JpaSecondaryTable(SecondaryTable annotation) { 39 name = annotation.name(); 40 catalog = annotation.catalog(); 41 schema = annotation.schema(); 42 43 getUniqueConstraints(); 44 for (int i = 0; i < annotation.uniqueConstraints().length; i++) { 45 uniqueConstraints.add(new JpaUniqueConstraint( 46 annotation.uniqueConstraints()[i])); 47 } 48 49 getPrimaryKeyJoinColumns(); 50 for (int i = 0; i < annotation.pkJoinColumns().length; i++) { 51 primaryKeyJoinColumns.add(new JpaPrimaryKeyJoinColumn(annotation 52 .pkJoinColumns()[i])); 53 } 54 } 55 56 @TreeNodeChild(type = JpaPrimaryKeyJoinColumn.class) 57 public Collection <JpaPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() { 58 if (primaryKeyJoinColumns == null) { 59 primaryKeyJoinColumns = new ArrayList <JpaPrimaryKeyJoinColumn>(); 60 } 61 62 return primaryKeyJoinColumns; 63 } 64 } 65 | Popular Tags |