javax.persistence.PrimaryKeyJoinColumns Java Examples
The following examples show how to use
javax.persistence.PrimaryKeyJoinColumns.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JPAOverriddenAnnotationReader.java From lams with GNU General Public License v2.0 | 6 votes |
/** * @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; } }
Example #2
Source File: DbUtil.java From cosmic with Apache License 2.0 | 5 votes |
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; }
Example #3
Source File: CreateXAnnotations.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 5 votes |
public XAnnotation<?> createPrimaryKeyJoinColumns( List<PrimaryKeyJoinColumn> cPrimaryKeyJoinColumn) { return transform( PrimaryKeyJoinColumns.class, javax.persistence.PrimaryKeyJoinColumn.class, cPrimaryKeyJoinColumn, new Transformer<PrimaryKeyJoinColumn, XAnnotation<javax.persistence.PrimaryKeyJoinColumn>>() { public XAnnotation<javax.persistence.PrimaryKeyJoinColumn> transform( PrimaryKeyJoinColumn input) { return createPrimaryKeyJoinColumn(input); } }); }
Example #4
Source File: DbUtil.java From cloudstack with Apache License 2.0 | 5 votes |
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; }