本文整理匯總了Java中javax.persistence.PrimaryKeyJoinColumn類的典型用法代碼示例。如果您正苦於以下問題:Java PrimaryKeyJoinColumn類的具體用法?Java PrimaryKeyJoinColumn怎麽用?Java PrimaryKeyJoinColumn使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PrimaryKeyJoinColumn類屬於javax.persistence包,在下文中一共展示了PrimaryKeyJoinColumn類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPrimaryKeyJoinColumns
import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
/**
* @param mergeWithAnnotations Whether to use Java annotations for this
* element, if present and not disabled by the XMLContext defaults.
* In some contexts (such as an association mapping) merging with
* annotations is never allowed.
*/
private PrimaryKeyJoinColumns getPrimaryKeyJoinColumns(Element element, XMLContext.Default defaults, boolean mergeWithAnnotations) {
PrimaryKeyJoinColumn[] columns = buildPrimaryKeyJoinColumns( element );
if ( mergeWithAnnotations ) {
if ( columns.length == 0 && defaults.canUseJavaAnnotations() ) {
PrimaryKeyJoinColumn annotation = getPhysicalAnnotation( PrimaryKeyJoinColumn.class );
if ( annotation != null ) {
columns = new PrimaryKeyJoinColumn[] { annotation };
}
else {
PrimaryKeyJoinColumns annotations = getPhysicalAnnotation( PrimaryKeyJoinColumns.class );
columns = annotations != null ? annotations.value() : columns;
}
}
}
if ( columns.length > 0 ) {
AnnotationDescriptor ad = new AnnotationDescriptor( PrimaryKeyJoinColumns.class );
ad.setValue( "value", columns );
return AnnotationFactory.create( ad );
}
else {
return null;
}
}
示例2: buildPrimaryKeyJoinColumns
import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
private PrimaryKeyJoinColumn[] buildPrimaryKeyJoinColumns(Element element) {
if ( element == null ) {
return new PrimaryKeyJoinColumn[] { };
}
List pkJoinColumnElementList = element.elements( "primary-key-join-column" );
PrimaryKeyJoinColumn[] pkJoinColumns = new PrimaryKeyJoinColumn[pkJoinColumnElementList.size()];
int index = 0;
Iterator pkIt = pkJoinColumnElementList.listIterator();
while ( pkIt.hasNext() ) {
Element subelement = (Element) pkIt.next();
AnnotationDescriptor pkAnn = new AnnotationDescriptor( PrimaryKeyJoinColumn.class );
copyStringAttribute( pkAnn, subelement, "name", false );
copyStringAttribute( pkAnn, subelement, "referenced-column-name", false );
copyStringAttribute( pkAnn, subelement, "column-definition", false );
pkJoinColumns[index++] = AnnotationFactory.create( pkAnn );
}
return pkJoinColumns;
}
示例3: buildPrimaryKeyJoinColumn
import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
private void buildPrimaryKeyJoinColumn() {
if (this.joinedParentClass.getIdProperty() instanceof SingularProperty) {
final PrimaryKeyJoinColumn pkColumn = this.entityClass.getAnnotation(PrimaryKeyJoinColumn.class);
final String columnName;
if (pkColumn == null || StringUtils.isEmpty(pkColumn.name())) {
columnName = ((SingularProperty<? super E, ?>) this.joinedParentClass.getIdProperty()).getColumn()
.getName();
} else {
columnName = pkColumn.name();
}
this.primaryKeyJoinColumn = this.table.resolveColumn(columnName);
} else {
throw new IllegalArgumentException(
"JOINED inheritance strategy is currently only supported with singular ID properties.");
}
}
示例4: getPrimaryKeyJoinColumns
import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
public static PrimaryKeyJoinColumn[] getPrimaryKeyJoinColumns(final Class<?> clazz) {
final PrimaryKeyJoinColumn pkjc = clazz.getAnnotation(PrimaryKeyJoinColumn.class);
if (pkjc != null) {
return new PrimaryKeyJoinColumn[]{pkjc};
}
final PrimaryKeyJoinColumns pkjcs = clazz.getAnnotation(PrimaryKeyJoinColumns.class);
if (pkjcs != null) {
return pkjcs.value();
}
return null;
}
示例5: addPrimaryKeyJoinColumns
import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
protected static void addPrimaryKeyJoinColumns(final StringBuilder sql, final String fromTable, final String toTable, final String joinType, final PrimaryKeyJoinColumn[]
pkjcs) {
if ("right".equalsIgnoreCase(joinType)) {
sql.append(" RIGHT JOIN ").append(toTable).append(" ON ");
} else if ("left".equalsIgnoreCase(joinType)) {
sql.append(" LEFT JOIN ").append(toTable).append(" ON ");
} else {
sql.append(" INNER JOIN ").append(toTable).append(" ON ");
}
for (final PrimaryKeyJoinColumn pkjc : pkjcs) {
sql.append(fromTable).append(".").append(pkjc.name());
final String refColumn = DbUtil.getReferenceColumn(pkjc);
sql.append("=").append(toTable).append(".").append(refColumn).append(" ");
}
}
示例6: getJobContent
import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "jobData")
@Fetch(FetchMode.SELECT)
@BatchSize(size = 10)
@MapKey(name = "jobId")
@PrimaryKeyJoinColumn(name = "JOB_ID")
public List<JobContent> getJobContent() {
return jobContent;
}
示例7: getPrimaryKeyJoinColumns
import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
public static PrimaryKeyJoinColumn[] getPrimaryKeyJoinColumns(Class<?> clazz) {
PrimaryKeyJoinColumn pkjc = clazz.getAnnotation(PrimaryKeyJoinColumn.class);
if (pkjc != null) {
return new PrimaryKeyJoinColumn[] {pkjc};
}
PrimaryKeyJoinColumns pkjcs = clazz.getAnnotation(PrimaryKeyJoinColumns.class);
if (pkjcs != null) {
return pkjcs.value();
}
return null;
}
示例8: addPrimaryKeyJoinColumns
import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
protected static void addPrimaryKeyJoinColumns(StringBuilder sql, String fromTable, String toTable, String joinType, PrimaryKeyJoinColumn[] pkjcs) {
if ("right".equalsIgnoreCase(joinType)) {
sql.append(" RIGHT JOIN ").append(toTable).append(" ON ");
} else if ("left".equalsIgnoreCase(joinType)) {
sql.append(" LEFT JOIN ").append(toTable).append(" ON ");
} else {
sql.append(" INNER JOIN ").append(toTable).append(" ON ");
}
for (PrimaryKeyJoinColumn pkjc : pkjcs) {
sql.append(fromTable).append(".").append(pkjc.name());
String refColumn = DbUtil.getReferenceColumn(pkjc);
sql.append("=").append(toTable).append(".").append(refColumn).append(" ");
}
}
示例9: createPrimaryColumnsToSecondaryTable
import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
private void createPrimaryColumnsToSecondaryTable(Object uncastedColumn, PropertyHolder propertyHolder, Join join) {
Ejb3JoinColumn[] ejb3JoinColumns;
PrimaryKeyJoinColumn[] pkColumnsAnn = null;
JoinColumn[] joinColumnsAnn = null;
if ( uncastedColumn instanceof PrimaryKeyJoinColumn[] ) {
pkColumnsAnn = (PrimaryKeyJoinColumn[]) uncastedColumn;
}
if ( uncastedColumn instanceof JoinColumn[] ) {
joinColumnsAnn = (JoinColumn[]) uncastedColumn;
}
if ( pkColumnsAnn == null && joinColumnsAnn == null ) {
ejb3JoinColumns = new Ejb3JoinColumn[1];
ejb3JoinColumns[0] = Ejb3JoinColumn.buildJoinColumn(
null,
null,
persistentClass.getIdentifier(),
secondaryTables,
propertyHolder, mappings
);
}
else {
int nbrOfJoinColumns = pkColumnsAnn != null ?
pkColumnsAnn.length :
joinColumnsAnn.length;
if ( nbrOfJoinColumns == 0 ) {
ejb3JoinColumns = new Ejb3JoinColumn[1];
ejb3JoinColumns[0] = Ejb3JoinColumn.buildJoinColumn(
null,
null,
persistentClass.getIdentifier(),
secondaryTables,
propertyHolder, mappings
);
}
else {
ejb3JoinColumns = new Ejb3JoinColumn[nbrOfJoinColumns];
if ( pkColumnsAnn != null ) {
for (int colIndex = 0; colIndex < nbrOfJoinColumns; colIndex++) {
ejb3JoinColumns[colIndex] = Ejb3JoinColumn.buildJoinColumn(
pkColumnsAnn[colIndex],
null,
persistentClass.getIdentifier(),
secondaryTables,
propertyHolder, mappings
);
}
}
else {
for (int colIndex = 0; colIndex < nbrOfJoinColumns; colIndex++) {
ejb3JoinColumns[colIndex] = Ejb3JoinColumn.buildJoinColumn(
null,
joinColumnsAnn[colIndex],
persistentClass.getIdentifier(),
secondaryTables,
propertyHolder, mappings
);
}
}
}
}
for (Ejb3JoinColumn joinColumn : ejb3JoinColumns) {
joinColumn.forceNotNull();
}
bindJoinToPersistentClass( join, ejb3JoinColumns, mappings );
}
示例10: isIdField
import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
private static boolean isIdField(final Field field) {
return field.isAnnotationPresent(Id.class) || field.isAnnotationPresent(PrimaryKeyJoinColumn.class);
}
示例11: getCustomerAccount
import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
public CustomerAccount getCustomerAccount() {
return this.customerAccount;
}
示例12: getCustomerAccount
import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
public CustomerAccount getCustomerAccount() {
return this.customerAccount;
}
示例13: getInvoice
import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
public Invoice getInvoice() {
return this.invoice;
}
示例14: getUser
import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
public User getUser() {
return this.user;
}
示例15: getTblstudents
import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
public Tblstudents getTblstudents() {
return this.tblstudents;
}