Java 类javax.persistence.OrderColumn 实例源码

项目:hyperjaxb3    文件:HJIII73Test.java   
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());
    }
项目:lams    文件:IndexColumn.java   
/**
     * 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.
     * @param mappings The mappings being built.
     *
     * @return The index column
     */
    public static IndexColumn buildColumnFromAnnotation(
            OrderColumn ann,
            PropertyHolder propertyHolder,
            PropertyData inferredData,
            Map<String, Join> secondaryTables,
            Mappings mappings) {
        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, mappings
            );
        }
        else {
            column = new IndexColumn(
                    true, null, 0, 0, 0, null, true,
                    false, true, true, null, null, propertyHolder, mappings
            );
        }
        return column;
    }
项目:lams    文件:JPAOverriddenAnnotationReader.java   
/**
 * 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 ) );
    }
}
项目:mycore    文件:MCRCategoryImpl.java   
@Override
@OneToMany(targetEntity = MCRCategoryImpl.class,
    cascade = {
        CascadeType.ALL },
    mappedBy = "parent")
@OrderColumn(name = "positionInParent")
@Access(AccessType.FIELD)
public List<MCRCategory> getChildren() {
    return super.getChildren();
}
项目:Project-H-Backend    文件:PatientKeyPerformanceIndicatorValidation.java   
/**
 * @return data
 */
@ElementCollection(fetch=FetchType.LAZY)
   @CollectionTable(name = "patient_kpi_validation_data", joinColumns = @JoinColumn(name = "patient_kpi_id"))
   @ForeignKey(name="fk_patient_kpi_data_pat_kpi_id")
   @OrderColumn(name="idx")
public List<BigDecimal> getData() {
    return this.data;
}
项目:omr    文件:ParticipationVO.java   
/**
 * @return the questionResults
 */
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "participationVO")
@IndexColumn(name = "PK")
@OrderColumn(name = "PK")
@Fetch(FetchMode.SELECT)
public List<CriterionResultVO> getCriterionResults() {
    return criterionResults;
}
项目:omr    文件:ParticipationVO.java   
/**
 * @return the questionResults
 */
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "participationVO")
@IndexColumn(name = "PK")
@OrderColumn(name = "PK")
@Fetch(FetchMode.SELECT)
public List<CriterionResultVO> getCriterionResults() {
    return criterionResults;
}
项目:omr    文件:ParticipationVO.java   
/**
 * @return the questionResults
 */
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "participationVO")
@IndexColumn(name = "PK")
@OrderColumn(name = "PK")
@Fetch(FetchMode.SELECT)
public List<CriterionResultVO> getCriterionResults() {
    return criterionResults;
}
项目:omr    文件:AbstractBaseVO.java   
/**
 * getter pk
 * 
 * @hibernate.id generator-class="native"
 */
@Id
@TableGenerator(name = "tbsed", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.IDENTITY)
@OrderColumn
public P getPK() {
    return this.pk;
}
项目:omr    文件:ParticipationVO.java   
/**
 * @return the questionResults
 */
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "participationVO")
@IndexColumn(name = "PK")
@OrderColumn(name = "PK")
@Fetch(FetchMode.SELECT)
public List<CriterionResultVO> getCriterionResults() {
    return criterionResults;
}
项目:org.fastnate    文件:CollectionProperty.java   
/**
 * Creates a new collection property.
 *
 * @param sourceClass
 *            the description of the current inspected class that contains this property
 * @param attribute
 *            accessor to the represented attribute
 * @param override
 *            the configured assocation override
 */
public CollectionProperty(final EntityClass<?> sourceClass, final AttributeAccessor attribute,
        final AssociationOverride override) {
    super(sourceClass, attribute, override, 0);

    // Read a potentially defined order column
    final OrderColumn orderColumnDef = attribute.getAnnotation(OrderColumn.class);
    this.orderColumn = orderColumnDef == null ? null
            : getTable().resolveColumn(
                    orderColumnDef.name().length() == 0 ? attribute.getName() + "_ORDER" : orderColumnDef.name());
}
项目:TicketManorJava    文件:MusicRecording.java   
@OneToMany(mappedBy="recording", cascade=CascadeType.ALL)
@OrderColumn(name="index_number")
public List<Track> getTracks() {
    if (tracks == null || tracks.length == 0) {
        return new ArrayList<Track>();
    }
    return Arrays.asList(tracks);
}
项目:projectforge-webapp    文件:RechnungsPositionDO.java   
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "rechnungs_pos_fk")
@OrderColumn(name = "index")
public List<KostZuweisungDO> getKostZuweisungen()
{
  return kostZuweisungen;
}
项目:projectforge-webapp    文件:EingangsrechnungsPositionDO.java   
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "eingangsrechnungs_pos_fk")
@OrderColumn(name = "index")
@Override
public List<KostZuweisungDO> getKostZuweisungen()
{
  return this.kostZuweisungen;
}
项目:hypothesis    文件:Branch.java   
@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinTable(name = TableConstants.BRANCH_TASK_TABLE, joinColumns = @JoinColumn(name = FieldConstants.BRANCH_ID) , inverseJoinColumns = @JoinColumn(name = FieldConstants.TASK_ID) )
@Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
@LazyCollection(LazyCollectionOption.TRUE)
@OrderColumn(name = FieldConstants.RANK)
public List<Task> getTasks() {
    return tasks;
}
项目:hypothesis    文件:Task.java   
@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinTable(name = TableConstants.TASK_SLIDE_TABLE, joinColumns = @JoinColumn(name = FieldConstants.TASK_ID), inverseJoinColumns = @JoinColumn(name = FieldConstants.SLIDE_ID))
@Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
@LazyCollection(LazyCollectionOption.TRUE)
@OrderColumn(name = FieldConstants.RANK)
public List<Slide> getSlides() {
    return slides;
}
项目:hypothesis    文件:Pack.java   
@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinTable(name = TableConstants.PACK_BRANCH_TABLE, joinColumns = @JoinColumn(name = FieldConstants.PACK_ID), inverseJoinColumns = @JoinColumn(name = FieldConstants.BRANCH_ID))
@Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
@LazyCollection(LazyCollectionOption.TRUE)
@OrderColumn(name = FieldConstants.RANK)
public List<Branch> getBranches() {
    return branches;
}
项目:hypothesis    文件:Test.java   
@OneToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinTable(name = TableConstants.TEST_EVENT_TABLE, joinColumns = @JoinColumn(name = FieldConstants.TEST_ID), inverseJoinColumns = @JoinColumn(name = FieldConstants.EVENT_ID))
@Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
@LazyCollection(LazyCollectionOption.TRUE)
@OrderColumn(name = FieldConstants.RANK)
public List<Event> getEvents() {
    return events;
}
项目:hypothesis    文件:Test.java   
@OneToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinTable(name = TableConstants.TEST_SCORE_TABLE, joinColumns = @JoinColumn(name = FieldConstants.TEST_ID) , inverseJoinColumns = @JoinColumn(name = FieldConstants.SCORE_ID) )
@Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
@LazyCollection(LazyCollectionOption.TRUE)
@OrderColumn(name = FieldConstants.RANK)
public List<Score> getScores() {
    return scores;
}
项目:Jouve-Project    文件:RecordCollection.java   
@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, orphanRemoval = true)
@OrderColumn(name = "searchResultFieldIndex")
@JoinColumn(name = "recordCollection_id", nullable = false)
public List<SearchResultField> getSearchResultFields() {
    return searchResultFields;
}
项目:opencucina    文件:Workflow.java   
/**
 * JAVADOC Method Level Comments
 *
 * @return JAVADOC.
 */
@OneToMany(orphanRemoval = true, cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "workflow")
@OrderColumn(insertable = true, updatable = true)
public List<WorkflowHistory> getWorkflowHistories() {
    return workflowHistories;
}
项目:exportlibrary    文件:ValidationReport.java   
/**
 * Gets the value of the validation 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 validation property.
 *
 * <p>
 * For example, to add a new item, do as follows:
 * <pre>
 *    getValidation().add(newItem);
 * </pre>
 *
 *
 * <p>
 * Objects of the following type(s) are allowed in the list
 * {@link Validation }
 *
 *
 */
@ManyToMany(targetEntity = Validation.class, cascade = {
    CascadeType.ALL
})
@JoinTable(name = "VALIDATION_REPORT_VALIDATION", joinColumns = {
    @JoinColumn(name = "validationreport", referencedColumnName = "HJID")
}, inverseJoinColumns = {
    @JoinColumn(name = "validation", referencedColumnName = "HJID")
}, uniqueConstraints =
        @UniqueConstraint(columnNames = {"validationreport", "validation"}))
@OrderColumn(name = "VALIDATION_HJORDER")
public Set<Validation> getValidation() {
    if (validation == null) {
        validation = new HashSet<>();
    }
    return this.validation;
}
项目:query-utils    文件:QueryUtils.java   
public static String resolveOrderColumn(ListAttribute<?,?> attr) {
    OrderColumn annotation = ((AnnotatedElement)attr.getJavaMember()).getAnnotation(OrderColumn.class);
    String specifiedValue = annotation.name();
    return specifiedValue != "" ? specifiedValue : attr.getName() + "_" + "ORDER";
}
项目:Jouve-Project    文件:RecordCollection.java   
@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, orphanRemoval = true)
@OrderColumn(name = "facetIndex")
@JoinColumn(name = "recordCollection_id", nullable = false)
public List<CollectionFacet> getCollectionFacets() {
    return collectionFacets;
}
项目:Jouve-Project    文件:Record.java   
@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, orphanRemoval = true)
@JoinTable(name = "Record_ContentMetas", joinColumns = { @JoinColumn(name = "record_id") }, inverseJoinColumns = { @JoinColumn(name = "meta_id") })
@OrderColumn
public List<RecordMeta> getContentMetas() {
    return contentMetas;
}
项目:Jouve-Project    文件:Record.java   
@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, orphanRemoval = true)
@JoinTable(name = "Record_ExternalMetas", joinColumns = { @JoinColumn(name = "record_id") }, inverseJoinColumns = { @JoinColumn(name = "meta_id") })
@OrderColumn
public List<RecordMeta> getExternalMetas() {
    return externalMetas;
}
项目:exportlibrary    文件:ValidationReportSet.java   
/**
 * Gets the value of the validationReport 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 validationReport property.
 * 
 * <p>
 * For example, to add a new item, do as follows:
 * <pre>
 *    getValidationReport().add(newItem);
 * </pre>
 * 
 * 
 * <p>
 * Objects of the following type(s) are allowed in the list
 * {@link ValidationReport }
 * 
 * 
 */
@OneToMany(targetEntity = ValidationReport.class, cascade = {
    CascadeType.ALL
}, orphanRemoval = true)
@JoinColumn(name = "VALIDATIONREPORT_VALIDATIONR_0")
@OrderColumn(name = "VALIDATIONREPORT_HJORDER")
public List<ValidationReport> getValidationReport() {
    if (validationReport == null) {
        validationReport = new ArrayList<ValidationReport>();
    }
    return this.validationReport;
}