本文整理匯總了Java中javax.persistence.JoinTable類的典型用法代碼示例。如果您正苦於以下問題:Java JoinTable類的具體用法?Java JoinTable怎麽用?Java JoinTable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
JoinTable類屬於javax.persistence包,在下文中一共展示了JoinTable類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAuthorities
import javax.persistence.JoinTable; //導入依賴的package包/類
/**
*
* @return
*/
@ElementCollection(targetClass=EAuthority.class,fetch=FetchType.EAGER)
@JoinTable(name = "grupo_autorities")
@Enumerated(EnumType.STRING)
@Fetch(FetchMode.SELECT)
public List<EAuthority> getAuthorities() {
return authorities;
}
示例2: getPlmVersions
import javax.persistence.JoinTable; //導入依賴的package包/類
/** @return . */
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "PLM_ISSUE_VERSION", joinColumns = { @JoinColumn(name = "ISSUE_ID", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "VERSION_ID", nullable = false, updatable = false) })
public Set<PlmVersion> getPlmVersions() {
return this.plmVersions;
}
示例3: buildHierarchyColumnOverride
import javax.persistence.JoinTable; //導入依賴的package包/類
private void buildHierarchyColumnOverride(XClass element) {
XClass current = element;
Map<String, Column[]> columnOverride = new HashMap<String, Column[]>();
Map<String, JoinColumn[]> joinColumnOverride = new HashMap<String, JoinColumn[]>();
Map<String, JoinTable> joinTableOverride = new HashMap<String, JoinTable>();
while ( current != null && !mappings.getReflectionManager().toXClass( Object.class ).equals( current ) ) {
if ( current.isAnnotationPresent( Entity.class ) || current.isAnnotationPresent( MappedSuperclass.class )
|| current.isAnnotationPresent( Embeddable.class ) ) {
//FIXME is embeddable override?
Map<String, Column[]> currentOverride = buildColumnOverride( current, getPath() );
Map<String, JoinColumn[]> currentJoinOverride = buildJoinColumnOverride( current, getPath() );
Map<String, JoinTable> currentJoinTableOverride = buildJoinTableOverride( current, getPath() );
currentOverride.putAll( columnOverride ); //subclasses have precedence over superclasses
currentJoinOverride.putAll( joinColumnOverride ); //subclasses have precedence over superclasses
currentJoinTableOverride.putAll( joinTableOverride ); //subclasses have precedence over superclasses
columnOverride = currentOverride;
joinColumnOverride = currentJoinOverride;
joinTableOverride = currentJoinTableOverride;
}
current = current.getSuperclass();
}
holderColumnOverride = columnOverride.size() > 0 ? columnOverride : null;
holderJoinColumnOverride = joinColumnOverride.size() > 0 ? joinColumnOverride : null;
holderJoinTableOverride = joinTableOverride.size() > 0 ? joinTableOverride : null;
}
示例4: buildJoinTable
import javax.persistence.JoinTable; //導入依賴的package包/類
private JoinTable buildJoinTable(Element tree, XMLContext.Default defaults) {
Element subelement = tree == null ? null : tree.element( "join-table" );
final Class<JoinTable> annotationType = JoinTable.class;
if ( subelement == null ) {
return null;
}
//ignore java annotation, an element is defined
AnnotationDescriptor annotation = new AnnotationDescriptor( annotationType );
copyStringAttribute( annotation, subelement, "name", false );
copyStringAttribute( annotation, subelement, "catalog", false );
if ( StringHelper.isNotEmpty( defaults.getCatalog() )
&& StringHelper.isEmpty( (String) annotation.valueOf( "catalog" ) ) ) {
annotation.setValue( "catalog", defaults.getCatalog() );
}
copyStringAttribute( annotation, subelement, "schema", false );
if ( StringHelper.isNotEmpty( defaults.getSchema() )
&& StringHelper.isEmpty( (String) annotation.valueOf( "schema" ) ) ) {
annotation.setValue( "schema", defaults.getSchema() );
}
buildUniqueConstraints( annotation, subelement );
buildIndex( annotation, subelement );
annotation.setValue( "joinColumns", getJoinColumns( subelement, false ) );
annotation.setValue( "inverseJoinColumns", getJoinColumns( subelement, true ) );
return AnnotationFactory.create( annotation );
}
示例5: buildAssociationOverrides
import javax.persistence.JoinTable; //導入依賴的package包/類
private List<AssociationOverride> buildAssociationOverrides(Element element, XMLContext.Default defaults) {
List<Element> subelements = element == null ? null : element.elements( "association-override" );
List<AssociationOverride> overrides = new ArrayList<AssociationOverride>();
if ( subelements != null && subelements.size() > 0 ) {
for ( Element current : subelements ) {
AnnotationDescriptor override = new AnnotationDescriptor( AssociationOverride.class );
copyStringAttribute( override, current, "name", true );
override.setValue( "joinColumns", getJoinColumns( current, false ) );
JoinTable joinTable = buildJoinTable( current, defaults );
if ( joinTable != null ) {
override.setValue( "joinTable", joinTable );
}
overrides.add( (AssociationOverride) AnnotationFactory.create( override ) );
}
}
return overrides;
}
示例6: getChildren
import javax.persistence.JoinTable; //導入依賴的package包/類
@ReadPermission(expression = "allow all OR deny all")
@UpdatePermission(expression = "allow all OR deny all")
// Hibernate
@ManyToMany(
targetEntity = Child.class,
cascade = { CascadeType.PERSIST, CascadeType.MERGE }
)
@JoinTable(
name = "Parent_Child",
joinColumns = @JoinColumn(name = "parent_id"),
inverseJoinColumns = @JoinColumn(name = "child_id")
)
@NotNull
public Set<Child> getChildren() {
return children;
}
示例7: buildTableName
import javax.persistence.JoinTable; //導入依賴的package包/類
/**
* Builds the name of the table of the association for the given field.
*
* @param attribute
* the inspected field
* @param override
* contains optional override options
* @param joinTable
* the optional join table
* @param collectionTable
* the optional metadata of the table
* @param defaultTableName
* the default name for the table
* @return the table name
*/
protected static String buildTableName(final AttributeAccessor attribute, final AssociationOverride override,
final JoinTable joinTable, final CollectionTable collectionTable, final String defaultTableName) {
if (override != null) {
final JoinTable joinTableOverride = override.joinTable();
if (joinTableOverride != null && joinTableOverride.name().length() > 0) {
return joinTableOverride.name();
}
}
if (joinTable != null && joinTable.name().length() > 0) {
return joinTable.name();
}
if (collectionTable != null && collectionTable.name().length() > 0) {
return collectionTable.name();
}
return defaultTableName;
}
示例8: getUpdateActivities
import javax.persistence.JoinTable; //導入依賴的package包/類
@ManyToMany(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinTable(name = "cellUpdateActivity",
joinColumns = @JoinColumn(name = "cellId", nullable = false, updatable = false),
inverseJoinColumns = @JoinColumn(name = "updateActivityId", nullable = false, updatable = false, unique = true))
@org.hibernate.annotations.Cascade(value = { org.hibernate.annotations.CascadeType.SAVE_UPDATE })
@Sort(type = SortType.NATURAL)
@ToMany(singularPropertyName = "updateActivity", hasNonconventionalMutation = true /*
* model testing framework doesn't
* understand this is a containment
* relationship, and so requires
* addUpdateActivity() method
*/)
@Override
public SortedSet<AdministrativeActivity> getUpdateActivities()
{
return _updateActivities;
}
示例9: getUpdateActivities
import javax.persistence.JoinTable; //導入依賴的package包/類
@ManyToMany(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinTable(name = "copyUpdateActivity",
joinColumns = @JoinColumn(name = "copyId", nullable = false, updatable = false),
inverseJoinColumns = @JoinColumn(name = "updateActivityId", nullable = false, updatable = false, unique = true))
@org.hibernate.annotations.Cascade(value = { org.hibernate.annotations.CascadeType.SAVE_UPDATE })
@Sort(type = SortType.NATURAL)
@ToMany(singularPropertyName = "updateActivity", hasNonconventionalMutation = true /*
* model testing framework doesn't
* understand this is a containment
* relationship, and so requires
* addUpdateActivity() method
*/)
@Override
public SortedSet<AdministrativeActivity> getUpdateActivities()
{
return _updateActivities;
}
示例10: getScreensaverUserRoles
import javax.persistence.JoinTable; //導入依賴的package包/類
/**
* Get the set of user roles that this user belongs to. Do not modify the
* contents of the returned collection: use
* {@link #addScreensaverUserRole(ScreensaverUserRole)} or
* {@link #removeScreensaverUserRole(ScreensaverUserRole)} instead.
*
* @return the set of user roles that this user belongs to
*/
@ElementCollection
@edu.harvard.med.screensaver.model.annotations.ElementCollection(hasNonconventionalMutation = true /*
* valid roles
* depend upon
* concrete entity
* type
*/)
@Column(name = "screensaverUserRole", nullable = false)
@JoinTable(name = "screensaverUserRole", joinColumns = @JoinColumn(name = "screensaverUserId"))
@org.hibernate.annotations.Type(type = "edu.harvard.med.screensaver.model.users.ScreensaverUserRole$UserType")
@org.hibernate.annotations.ForeignKey(name = "fk_screensaver_user_role_type_to_screensaver_user")
public Set<ScreensaverUserRole> getScreensaverUserRoles()
{
return _roles;
}
示例11: getProtocolApplications
import javax.persistence.JoinTable; //導入依賴的package包/類
/**
* {@inheritDoc}
*/
// should really be one-to-many, but hibernate bug HHH-3160/HHH-1296 prevents reordering or deleting from the list
// with a unique constraint on protocol_application
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
name = "biomaterial_protocol_application",
joinColumns = @JoinColumn(name = "bio_material"),
inverseJoinColumns = @JoinColumn(name = "protocol_application")
)
@IndexColumn(name = "protocol_order")
@ForeignKey(name = "biomaterial_protocol_application_bio_material_fk",
inverseName = "biomaterial_protocol_application_protocol_application_fk")
@Cascade({ org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.DELETE,
org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
public List<ProtocolApplication> getProtocolApplications() {
return this.protocolApplications;
}
示例12: getProtocolApplications
import javax.persistence.JoinTable; //導入依賴的package包/類
/**
* {@inheritDoc}
*/
// should really be one-to-many, but hibernate bug HHH-3160/HHH-1296 prevents reordering or deleting from the list
// with a unique constraint on protocol_application
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
name = "hybridization_protocol_application",
joinColumns = @JoinColumn(name = "hybridization"),
inverseJoinColumns = @JoinColumn(name = "protocol_application")
)
@IndexColumn(name = "protocol_order")
@ForeignKey(name = "hybridization_protocol_application_hybridization_fk",
inverseName = "hybridization_protocol_application_protocol_application_fk")
@Cascade({ org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.DELETE,
org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
public List<ProtocolApplication> getProtocolApplications() {
return this.protocolApplications;
}
示例13:
import javax.persistence.JoinTable; //導入依賴的package包/類
@ManyToMany(fetch = FetchType.LAZY)
@MapKeyJoinColumn(name = "REAL_NETWORK_INTERFACE_ID", nullable = false)
@JoinTable(
name = "SIMULATION__"
+ "REAL_NETWORK_INTERFACE__"
+ "REAL_NETWORK_INTERFACE_CONFIGURATION",
joinColumns
= @JoinColumn(name = "SIMULATION_ID", nullable = false),
inverseJoinColumns
= @JoinColumn(
name = "REAL_NETWORK_INTERFACE_CONFIGURATION_ID",
nullable = false
)
)
public Map<RealNetworkInterface, RealNetworkInterfaceConfiguration>
getRealNetworkInterfaceConfigurations() {
return realNetworkInterfaceConfigurations;
}
示例14: buildDefaultJoinColumnsForXToOne
import javax.persistence.JoinTable; //導入依賴的package包/類
Ejb3JoinColumn[] buildDefaultJoinColumnsForXToOne(XProperty property, PropertyData inferredData) {
Ejb3JoinColumn[] joinColumns;
JoinTable joinTableAnn = propertyHolder.getJoinTable( property );
if ( joinTableAnn != null ) {
joinColumns = Ejb3JoinColumn.buildJoinColumns(
joinTableAnn.inverseJoinColumns(), null, entityBinder.getSecondaryTables(),
propertyHolder, inferredData.getPropertyName(), mappings
);
if ( StringHelper.isEmpty( joinTableAnn.name() ) ) {
throw new AnnotationException(
"JoinTable.name() on a @ToOne association has to be explicit: "
+ BinderHelper.getPath( propertyHolder, inferredData )
);
}
}
else {
OneToOne oneToOneAnn = property.getAnnotation( OneToOne.class );
String mappedBy = oneToOneAnn != null ?
oneToOneAnn.mappedBy() :
null;
joinColumns = Ejb3JoinColumn.buildJoinColumns(
null,
mappedBy, entityBinder.getSecondaryTables(),
propertyHolder, inferredData.getPropertyName(), mappings
);
}
return joinColumns;
}
示例15: getJoinTable
import javax.persistence.JoinTable; //導入依賴的package包/類
/**
* Get column overriding, property first, then parent, then holder
* replace the placeholder 'collection&&element' with nothing
*
* These rules are here to support both JPA 2 and legacy overriding rules.
*/
@Override
public JoinTable getJoinTable(XProperty property) {
final String propertyName = StringHelper.qualify( getPath(), property.getName() );
JoinTable result = getOverriddenJoinTable( propertyName );
if (result == null) {
result = property.getAnnotation( JoinTable.class );
}
return result;
}