Java Code Examples for javax.persistence.MapKeyColumn

The following examples show how to use javax.persistence.MapKeyColumn. These examples are extracted from open source projects. 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
private void getMapKeyColumn(List<Annotation> annotationList, Element element) {
	Element subelement = element != null ? element.element( "map-key-column" ) : null;
	if ( subelement != null ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( MapKeyColumn.class );
		copyStringAttribute( ad, subelement, "name", false );
		copyBooleanAttribute( ad, subelement, "unique" );
		copyBooleanAttribute( ad, subelement, "nullable" );
		copyBooleanAttribute( ad, subelement, "insertable" );
		copyBooleanAttribute( ad, subelement, "updatable" );
		copyStringAttribute( ad, subelement, "column-definition", false );
		copyStringAttribute( ad, subelement, "table", false );
		copyIntegerAttribute( ad, subelement, "length" );
		copyIntegerAttribute( ad, subelement, "precision" );
		copyIntegerAttribute( ad, subelement, "scale" );
		annotationList.add( AnnotationFactory.create( ad ) );
	}
}
 
Example 2
Source Project: lams   Source File: MapBinder.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void makeOneToManyMapKeyColumnNullableIfNotInProperty(
		final XProperty property) {
	final org.hibernate.mapping.Map map = (org.hibernate.mapping.Map) this.collection;
	if ( map.isOneToMany() &&
			property.isAnnotationPresent( MapKeyColumn.class ) ) {
		final Value indexValue = map.getIndex();
		if ( indexValue.getColumnSpan() != 1 ) {
			throw new AssertionFailure( "Map key mapped by @MapKeyColumn does not have 1 column" );
		}
		final Selectable selectable = indexValue.getColumnIterator().next();
		if ( selectable.isFormula() ) {
			throw new AssertionFailure( "Map key mapped by @MapKeyColumn is a Formula" );
		}
		Column column = (Column) map.getIndex().getColumnIterator().next();
		if ( !column.isNullable() ) {
			final PersistentClass persistentClass = ( ( OneToMany ) map.getElement() ).getAssociatedClass();
			// check if the index column has been mapped by the associated entity to a property;
			// @MapKeyColumn only maps a column to the primary table for the one-to-many, so we only
			// need to check "un-joined" properties.
			if ( !propertyIteratorContainsColumn( persistentClass.getUnjoinedPropertyIterator(), column ) ) {
				// The index column is not mapped to an associated entity property so we can
				// safely make the index column nullable.
				column.setNullable( true );
			}
		}
	}
}
 
Example 3
Source Project: metacat   Source File: Info.java    License: Apache License 2.0 5 votes vote down vote up
@ElementCollection
@MapKeyColumn(name = "parameters_idx")
@Column(name = "parameters_elt")
@CollectionTable(name = "info_parameters")
public Map<String, String> getParameters() {
    return parameters;
}
 
Example 4
Source Project: mycore   Source File: MCRJob.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns all set parameters of the job.
 * 
 * @return the job parameters
 */
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name = "MCRJobParameter", joinColumns = @JoinColumn(name = "jobID"))
@MapKeyColumn(name = "paramKey", length = 128)
@Column(name = "paramValue", length = 255)
public Map<String, String> getParameters() {
    return parameters;
}
 
Example 5
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name="attribute", insertable=false,updatable=false)
@Column(name="value")
@CollectionTable(name="timing_location_input_attributes", [email protected](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 6
Source Project: pikatimer   Source File: Bib2ChipMap.java    License: GNU General Public License v3.0 5 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name="chip", insertable=false,updatable=false)
@Column(name="bib")
@CollectionTable(name="bib2chipmap", [email protected](name="bib2chip_id"))
public Map<String, String> getChip2BibMap() {
    //System.out.println("TLI.getAttributes called, returning " + attributes.size() + " attributes");
    return chip2bibMap;
}
 
Example 7
Source Project: pikatimer   Source File: Participant.java    License: GNU General Public License v3.0 5 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name="attribute_id")
@Column(name="attribute_value")
@CollectionTable(name="participant_attributes", [email protected](name="participant_id"))
public Map<Integer,String> getCustomAttributes(){
    return customAttributeMap;
}
 
Example 8
Source Project: pikatimer   Source File: EventOptions.java    License: 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="event_options_attributes", [email protected](name="event_id"))
//@OrderColumn(name = "index_id")
private Map<String, String> getAttributes() {
    System.out.println("EventOptions::getAttributes()");
    attributes.keySet().forEach(k -> {
    System.out.println("  " + k + " -> " + attributes.get(k));
    });
    return attributes;
}
 
Example 9
Source Project: pikatimer   Source File: RaceAwards.java    License: 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", [email protected](name="race_id"))
@OrderColumn(name = "index_id")
private Map<String, String> getAttributes() {
    return attributes;
}
 
Example 10
Source Project: pikatimer   Source File: Race.java    License: 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_attributes", [email protected](name="race_id"))
private Map<String, String> getAttributes() {
    return attributes;
}
 
Example 11
Source Project: pikatimer   Source File: RaceReport.java    License: 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", [email protected](name="output_id"))
@OrderColumn(name = "id")
private Map<String, String> getAttributes() {
    return attributes;
}
 
Example 12
Source Project: pikatimer   Source File: Result.java    License: GNU General Public License v3.0 5 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name="split_id", insertable=false,updatable=false)
@Column(name="split_time",nullable=false)
@CollectionTable(name="split_results", [email protected](name="result_id"))
public Map<Integer,Long> getSplitMap(){
    return splitMap;
}
 
Example 13
Source Project: lams   Source File: MapKeyColumnDelegator.java    License: GNU General Public License v2.0 4 votes vote down vote up
public MapKeyColumnDelegator(MapKeyColumn column) {
	this.column = column;
}
 
Example 14
Source Project: cxf   Source File: ServerAuthorizationCodeGrant.java    License: Apache License 2.0 4 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name = "extraPropName")
public Map<String, String> getExtraProperties() {
    return extraProperties;
}
 
Example 15
Source Project: cxf   Source File: Client.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Get the list of additional client properties
 * @return the list of properties
 */
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name = "name")
public Map<String, String> getProperties() {
    return properties;
}
 
Example 16
Source Project: cxf   Source File: UserSubject.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Get the list of additional user subject properties
 *
 * @return the list of properties
 */
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name = "name")
public Map<String, String> getProperties() {
    return properties;
}
 
Example 17
Source Project: cxf   Source File: AccessToken.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Gets token parameters
 * @return
 */
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name = "propName")
public Map<String, String> getParameters() {
    return parameters;
}
 
Example 18
Source Project: cxf   Source File: ServerAccessToken.java    License: Apache License 2.0 4 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name = "extraPropName")
public Map<String, String> getExtraProperties() {
    return extraProperties;
}