javax.persistence.CollectionTable Java Examples

The following examples show how to use javax.persistence.CollectionTable. 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 getCollectionTable(List<Annotation> annotationList, Element element, XMLContext.Default defaults) {
	Element subelement = element != null ? element.element( "collection-table" ) : null;
	if ( subelement != null ) {
		AnnotationDescriptor annotation = new AnnotationDescriptor( CollectionTable.class );
		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() );
		}
		JoinColumn[] joinColumns = getJoinColumns( subelement, false );
		if ( joinColumns.length > 0 ) {
			annotation.setValue( "joinColumns", joinColumns );
		}
		buildUniqueConstraints( annotation, subelement );
		buildIndex( annotation, subelement );
		annotationList.add( AnnotationFactory.create( annotation ) );
	}
}
 
Example #2
Source File: AwardCategory.java    From pikatimer with GNU General Public License v3.0 5 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(
      name="race_award_category_filters",
      joinColumns=@JoinColumn(name="ac_id")
)
protected List<AwardFilter> getFilterList(){
    return filters;
}
 
Example #3
Source File: User.java    From website with GNU Affero General Public License v3.0 5 votes vote down vote up
@ElementCollection(targetClass = Permission.class, fetch = FetchType.EAGER)
@CollectionTable(name = "USER_PERMISSIONS", joinColumns = @JoinColumn(name = "USER_ID"))
@Enumerated(EnumType.STRING)
@Column(name = "permission", nullable = false)
public Set<Permission> getPermissions() {
	return permissions;
}
 
Example #4
Source File: User.java    From website with GNU Affero General Public License v3.0 5 votes vote down vote up
@ElementCollection(targetClass = Role.class, fetch = FetchType.EAGER)
@CollectionTable(name = "USER_ROLES", joinColumns = @JoinColumn(name = "USER_ID"))
@Enumerated(EnumType.STRING)
@Column(name = "role", nullable = false)
public Set<Role> getRoles() {
	return roles;
}
 
Example #5
Source File: TaskData.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
@ElementCollection(fetch = FetchType.LAZY)
@CollectionTable(name = "TASK_DATA_JOINED_BRANCHES", joinColumns = { @JoinColumn(name = "JOB_ID", referencedColumnName = "TASK_ID_JOB"),
                                                                     @JoinColumn(name = "TASK_ID", referencedColumnName = "TASK_ID_TASK") }, indexes = { @Index(name = "TASK_DATA_JB_JOB_ID", columnList = "JOB_ID"),
                                                                                                                                                         @Index(name = "TASK_DATA_JB_TASK_ID_JOB_ID", columnList = "TASK_ID,JOB_ID"),
                                                                                                                                                         @Index(name = "TASK_DATA_JB_TASK_ID", columnList = "TASK_ID"), })
@BatchSize(size = 100)
public List<DBTaskId> getJoinedBranches() {
    return joinedBranches;
}
 
Example #6
Source File: TaskData.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
@ElementCollection(fetch = FetchType.LAZY)
@CollectionTable(name = "TASK_DATA_DEPENDENCIES", joinColumns = { @JoinColumn(name = "JOB_ID", referencedColumnName = "TASK_ID_JOB"),
                                                                  @JoinColumn(name = "TASK_ID", referencedColumnName = "TASK_ID_TASK") }, indexes = { @Index(name = "TASK_DATA_DEP_JOB_ID", columnList = "JOB_ID"),
                                                                                                                                                      @Index(name = "TASK_DATA_DEP_TASK_ID_JOB_ID", columnList = "TASK_ID,JOB_ID"),
                                                                                                                                                      @Index(name = "TASK_DATA_DEP_TASK_ID", columnList = "TASK_ID"), })
@BatchSize(size = 100)
public List<DBTaskId> getDependentTasks() {
    return dependentTasks;
}
 
Example #7
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 #8
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 #9
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 #10
Source File: AgeGroups.java    From pikatimer with GNU General Public License v3.0 5 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(
      name="race_age_group_increments",
      joinColumns=@JoinColumn(name="ag_id")
)
protected List<AgeGroupIncrement> getCustomIncrementsList(){
    return customIncrementList;
}
 
Example #11
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 #12
Source File: AwardCategory.java    From pikatimer with GNU General Public License v3.0 5 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(
      name="race_award_category_subdivide_list",
      joinColumns=@JoinColumn(name="ac_id")
)
@Column(name="attribute")
protected Set<String> getSubDivideList(){
    return splitBy;
}
 
Example #13
Source File: AwardCategory.java    From pikatimer with GNU General Public License v3.0 5 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(
      name="race_award_category_depths",
      joinColumns=@JoinColumn(name="ac_id")
)
protected List<AwardDepth> getCustomDepthList(){
    return customDepthList;
}
 
Example #14
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 #15
Source File: Participant.java    From pikatimer with GNU General Public License v3.0 5 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
    @Column(name="wave_id", nullable=false)
    @CollectionTable(name="part2wave", joinColumns=@JoinColumn(name="participant_id"))
//    @OrderColumn(name = "index_id")
    public Set<Integer> getWaveIDs() {
        return waveIDSet;  
    }
 
Example #16
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 #17
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 #18
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 #19
Source File: MCRCategoryImpl.java    From mycore with GNU General Public License v3.0 5 votes vote down vote up
@Override
@ElementCollection(fetch = FetchType.LAZY)
@CollectionTable(name = "MCRCategoryLabels",
    joinColumns = @JoinColumn(name = "category"),
    uniqueConstraints = {
        @UniqueConstraint(columnNames = { "category", "lang" }) })
public Set<MCRLabel> getLabels() {
    return super.getLabels();
}
 
Example #20
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 #21
Source File: MCRUser.java    From mycore with GNU General Public License v3.0 5 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name = "MCRUserAttr",
    joinColumns = @JoinColumn(name = "id"),
    indexes = { @Index(name = "MCRUserAttributes", columnList = "name, value"),
        @Index(name = "MCRUserValues", columnList = "value") })
@SortNatural
@XmlElementWrapper(name = "attributes")
@XmlElement(name = "attribute")
public SortedSet<MCRUserAttribute> getAttributes() {
    return this.attributes;
}
 
Example #22
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 #23
Source File: CustomAttribute.java    From pikatimer with GNU General Public License v3.0 4 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@Column(name="value", nullable=false)
@CollectionTable(name="custom_participant_attributes_values", joinColumns=@JoinColumn(name="id"))
public List<String> getAllowableValues() {
    return allowable_values;  
}
 
Example #24
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;
}