javax.persistence.MapKeyColumn Java Examples

The following examples show how to use javax.persistence.MapKeyColumn. 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 vote down vote up
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 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 #3
Source File: Result.java    From pikatimer with 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", joinColumns=@JoinColumn(name="result_id"))
public Map<Integer,Long> getSplitMap(){
    return splitMap;
}
 
Example #4
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 #5
Source File: Race.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_attributes", joinColumns=@JoinColumn(name="race_id"))
private Map<String, String> getAttributes() {
    return attributes;
}
 
Example #6
Source File: EventOptions.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="event_options_attributes", joinColumns=@JoinColumn(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 #7
Source File: Participant.java    From pikatimer with 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", joinColumns=@JoinColumn(name="participant_id"))
public Map<Integer,String> getCustomAttributes(){
    return customAttributeMap;
}
 
Example #8
Source File: Bib2ChipMap.java    From pikatimer with 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", joinColumns=@JoinColumn(name="bib2chip_id"))
public Map<String, String> getChip2BibMap() {
    //System.out.println("TLI.getAttributes called, returning " + attributes.size() + " attributes");
    return chip2bibMap;
}
 
Example #9
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 #10
Source File: MCRJob.java    From mycore with 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 #11
Source File: Info.java    From metacat with 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 #12
Source File: MapBinder.java    From lams with 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 #13
Source File: MapKeyColumnDelegator.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public MapKeyColumnDelegator(MapKeyColumn column) {
	this.column = column;
}
 
Example #14
Source File: ServerAuthorizationCodeGrant.java    From cxf with 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 File: Client.java    From cxf with 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 File: UserSubject.java    From cxf with 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 File: AccessToken.java    From cxf with 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 File: ServerAccessToken.java    From cxf with Apache License 2.0 4 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name = "extraPropName")
public Map<String, String> getExtraProperties() {
    return extraProperties;
}