javax.persistence.OrderColumn Java Examples

The following examples show how to use javax.persistence.OrderColumn. 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: HJIII73Test.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void testLengthAnnotation() throws Exception {

		final AnnotatedElementFactory aef = new DualAnnotatedElementFactory();

		final ParameterizedAnnotatedElement o2m = aef
				.getAnnotatedElement(HJIII73Parent.class
						.getMethod("getHJIII73ChildOneToMany"));
		final ParameterizedAnnotatedElement m2m = aef
				.getAnnotatedElement(HJIII73Parent.class
						.getMethod("getHJIII73ChildManyToMany"));

		Assert.assertNotNull(o2m.getAnnotation(OrderColumn.class));
		Assert.assertTrue(o2m.getAnnotation(OrderColumn.class).name().length() > 0);
		Assert.assertNotNull(m2m.getAnnotation(OrderColumn.class));
		Assert.assertEquals("ORDNUNG", m2m.getAnnotation(OrderColumn.class)
				.name());
	}
 
Example #2
Source File: MybatisPersistentPropertyImpl.java    From spring-data-mybatis with Apache License 2.0 6 votes vote down vote up
@Override
public String getColumnName() {

	if (isAnnotationPresent(Column.class)) {
		Column column = getRequiredAnnotation(Column.class);
		if (StringUtils.hasText(column.name())) {
			return column.name();
		}
	}

	if (isAnnotationPresent(OrderColumn.class)) {
		OrderColumn orderColumn = getRequiredAnnotation(OrderColumn.class);
		if (StringUtils.hasText(orderColumn.name())) {
			return orderColumn.name();
		}
	}

	return getOwner().getFieldNamingStrategy().getFieldName(this);
}
 
Example #3
Source File: JPAOverriddenAnnotationReader.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds an @OrderColumn annotation to the specified annotationList if the specified element
 * contains an order-column sub-element. This should only be the case for element-collection,
 * many-to-many, or one-to-many associations.
 */
private void getOrderColumn(List<Annotation> annotationList, Element element) {
	Element subelement = element != null ? element.element( "order-column" ) : null;
	if ( subelement != null ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( OrderColumn.class );
		copyStringAttribute( ad, subelement, "name", false );
		copyBooleanAttribute( ad, subelement, "nullable" );
		copyBooleanAttribute( ad, subelement, "insertable" );
		copyBooleanAttribute( ad, subelement, "updatable" );
		copyStringAttribute( ad, subelement, "column-definition", false );
		annotationList.add( AnnotationFactory.create( ad ) );
	}
}
 
Example #4
Source File: EingangsrechnungsPositionDO.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "eingangsrechnungs_pos_fk")
@OrderColumn(name = "index")
@Override
public List<KostZuweisungDO> getKostZuweisungen()
{
  return this.kostZuweisungen;
}
 
Example #5
Source File: RechnungsPositionDO.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "rechnungs_pos_fk")
@OrderColumn(name = "index")
public List<KostZuweisungDO> getKostZuweisungen()
{
  return kostZuweisungen;
}
 
Example #6
Source File: TaskData.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
@Cascade(CascadeType.ALL)
@OneToMany(fetch = FetchType.LAZY, mappedBy = "taskData")
@OnDelete(action = OnDeleteAction.CASCADE)
@OrderColumn(name = "DS_SELECTOR_ORDER")
public List<SelectorData> getDataspaceSelectors() {
    return dataspaceSelectors;
}
 
Example #7
Source File: TaskData.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
@Cascade(CascadeType.ALL)
@OneToMany(fetch = FetchType.LAZY, mappedBy = "taskData")
@OnDelete(action = OnDeleteAction.CASCADE)
@OrderColumn(name = "SCRIPT_ORDER")
public List<SelectionScriptData> getSelectionScripts() {
    return selectionScripts;
}
 
Example #8
Source File: RaceAwards.java    From pikatimer with GNU General Public License v3.0 5 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name="attribute", insertable=false,updatable=false)
@Column(name="value")
@CollectionTable(name="race_awards_attributes", joinColumns=@JoinColumn(name="race_id"))
@OrderColumn(name = "index_id")
private Map<String, String> getAttributes() {
    return attributes;
}
 
Example #9
Source File: RaceAwards.java    From pikatimer with GNU General Public License v3.0 5 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@OneToMany(mappedBy="raceAward",cascade={CascadeType.PERSIST, CascadeType.REMOVE},fetch = FetchType.EAGER)
@Fetch(FetchMode.SELECT)
@OrderColumn(name = "category_priority")
public List<AwardCategory> getAwardCategories(){
    return awardCategories;
}
 
Example #10
Source File: RaceReport.java    From pikatimer with GNU General Public License v3.0 5 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name="attribute", insertable=false,updatable=false)
@Column(name="value")
@CollectionTable(name="race_output_attributes", joinColumns=@JoinColumn(name="output_id"))
@OrderColumn(name = "id")
private Map<String, String> getAttributes() {
    return attributes;
}
 
Example #11
Source File: TimingLocationInput.java    From pikatimer with GNU General Public License v3.0 5 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name="attribute", insertable=false,updatable=false)
@Column(name="value")
@CollectionTable(name="timing_location_input_attributes", joinColumns=@JoinColumn(name="tli_id"))
@OrderColumn(name = "index_id")
public Map<String, String> getAttributes() {
    //System.out.println("TLI.getAttributes called, returning " + attributes.size() + " attributes");
    return attributes;
}
 
Example #12
Source File: MCRCategoryImpl.java    From mycore with GNU General Public License v3.0 5 votes vote down vote up
@Override
@OneToMany(targetEntity = MCRCategoryImpl.class,
    cascade = {
        CascadeType.ALL },
    mappedBy = "parent")
@OrderColumn(name = "positionInParent")
@Access(AccessType.FIELD)
public List<MCRCategory> getChildren() {
    return super.getChildren();
}
 
Example #13
Source File: IndexColumn.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
	 * JPA 2 {@link OrderColumn @OrderColumn} processing.
	 *
	 * @param ann The OrderColumn annotation instance
	 * @param propertyHolder Information about the property
	 * @param inferredData Yeah, right.  Uh...
	 * @param secondaryTables Any secondary tables available.
	 *
	 * @return The index column
	 */
	public static IndexColumn buildColumnFromAnnotation(
			OrderColumn ann,
			PropertyHolder propertyHolder,
			PropertyData inferredData,
			Map<String, Join> secondaryTables,
			MetadataBuildingContext buildingContext) {
		final IndexColumn column;
		if ( ann != null ) {
			final String sqlType = BinderHelper.isEmptyAnnotationValue( ann.columnDefinition() ) ? null : ann.columnDefinition();
			final String name = BinderHelper.isEmptyAnnotationValue( ann.name() ) ? inferredData.getPropertyName() + "_ORDER" : ann.name();
			//TODO move it to a getter based system and remove the constructor
// The JPA OrderColumn annotation defines no table element...
//			column = new IndexColumn(
//					false, sqlType, 0, 0, 0, name, ann.nullable(),
//					false, ann.insertable(), ann.updatable(), ann.table(),
//					secondaryTables, propertyHolder, mappings
//			);
			column = new IndexColumn(
					false,
					sqlType,
					0,
					0,
					0,
					name,
					ann.nullable(),
					false,
					ann.insertable(),
					ann.updatable(),
					/*ann.table()*/null,
					secondaryTables,
					propertyHolder,
					buildingContext
			);
		}
		else {
			column = new IndexColumn(
					true,
					null,
					0,
					0,
					0,
					null,
					true,
					false,
					true,
					true,
					null,
					null,
					propertyHolder,
					buildingContext
			);
		}
		return column;
	}
 
Example #14
Source File: ServerAccessToken.java    From cxf with Apache License 2.0 4 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@OrderColumn
public List<String> getAudiences() {
    return audiences;
}
 
Example #15
Source File: Client.java    From cxf with Apache License 2.0 4 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@OrderColumn
@Lob
public List<String> getApplicationCertificates() {
    return applicationCertificates;
}
 
Example #16
Source File: Client.java    From cxf with Apache License 2.0 4 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@OrderColumn
public List<String> getRegisteredAudiences() {
    return registeredAudiences;
}
 
Example #17
Source File: Client.java    From cxf with Apache License 2.0 4 votes vote down vote up
/**
 * Get the list of registered scopes
 * @return scopes
 */
@ElementCollection(fetch = FetchType.EAGER)
@OrderColumn
public List<String> getRegisteredScopes() {
    return registeredScopes;
}
 
Example #18
Source File: Client.java    From cxf with Apache License 2.0 4 votes vote down vote up
/**
 * Get the list of access token grant types this client
 * can use to obtain the access tokens.
 * @return the list of grant types
 */
@ElementCollection(fetch = FetchType.EAGER)
@OrderColumn
public List<String> getAllowedGrantTypes() {
    return allowedGrantTypes;
}
 
Example #19
Source File: Client.java    From cxf with Apache License 2.0 4 votes vote down vote up
/**
 * Get a list of URIs the AuthorizationService
 * may return the authorization code to
 * @return the redirect uris
 */
@ElementCollection(fetch = FetchType.EAGER)
@OrderColumn
public List<String> getRedirectUris() {
    return redirectUris;
}
 
Example #20
Source File: OAuthPermission.java    From cxf with Apache License 2.0 4 votes vote down vote up
/**
 * Gets the optional list of relative request URIs
 * @return the list of URIs
 */
@ElementCollection(fetch = FetchType.EAGER)
@OrderColumn
public List<String> getUris() {
    return uris;
}
 
Example #21
Source File: OAuthPermission.java    From cxf with Apache License 2.0 4 votes vote down vote up
/**
 * Gets the optional list of HTTP verbs
 * @return the list of HTTP verbs
 */
@ElementCollection(fetch = FetchType.EAGER)
@OrderColumn
public List<String> getHttpVerbs() {
    return httpVerbs;
}
 
Example #22
Source File: RefreshToken.java    From cxf with Apache License 2.0 4 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@OrderColumn
public List<String> getAccessTokens() {
    return accessTokens;
}
 
Example #23
Source File: ServerAuthorizationCodeGrant.java    From cxf with Apache License 2.0 4 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@OrderColumn
public List<String> getRequestedScopes() {
    return requestedScopes;
}
 
Example #24
Source File: ServerAuthorizationCodeGrant.java    From cxf with Apache License 2.0 4 votes vote down vote up
/**
 * Gets the scopes explicitly approved by the end user
 * @return the approved scopes
 */
@ElementCollection(fetch = FetchType.EAGER)
@OrderColumn
public List<String> getApprovedScopes() {
    return approvedScopes;
}
 
Example #25
Source File: UserAccount.java    From cia with Apache License 2.0 3 votes vote down vote up
/**
 * Gets the value of the address property.
 * 
 * <p>
 * This accessor method returns a reference to the live list,
 * not a snapshot. Therefore any modification you make to the
 * returned list will be present inside the JAXB object.
 * This is why there is not a <CODE>set</CODE> method for the address property.
 * 
 * <p>
 * For example, to add a new item, do as follows:
 * <pre>
 *    getAddress().add(newItem);
 * </pre>
 * 
 * 
 * <p>
 * Objects of the following type(s) are allowed in the list
 * {@link String }
 * 
 * 
 */
@ElementCollection
@OrderColumn(name = "HJINDEX")
@Column(name = "HJVALUE")
@CollectionTable(name = "USER_ACCOUNT_ADDRESS", joinColumns = {
    @JoinColumn(name = "HJID")
})
public List<String> getAddress() {
    if (address == null) {
        address = new ArrayList<>();
    }
    return this.address;
}
 
Example #26
Source File: UserSubject.java    From cxf with Apache License 2.0 2 votes vote down vote up
/**
 * Return the optional list of user roles which may have
 * been captured during the authentication process
 *
 * @return the list of roles
 */
@ElementCollection(fetch = FetchType.EAGER)
@OrderColumn
public List<String> getRoles() {
    return roles;
}