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()); }
/** * 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; }
/** * 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 ) ); } }
@Override @OneToMany(targetEntity = MCRCategoryImpl.class, cascade = { CascadeType.ALL }, mappedBy = "parent") @OrderColumn(name = "positionInParent") @Access(AccessType.FIELD) public List<MCRCategory> getChildren() { return super.getChildren(); }
/** * @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; }
/** * @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; }
/** * getter pk * * @hibernate.id generator-class="native" */ @Id @TableGenerator(name = "tbsed", allocationSize = 1) @GeneratedValue(strategy = GenerationType.IDENTITY) @OrderColumn public P getPK() { return this.pk; }
/** * 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()); }
@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); }
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "rechnungs_pos_fk") @OrderColumn(name = "index") public List<KostZuweisungDO> getKostZuweisungen() { return kostZuweisungen; }
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "eingangsrechnungs_pos_fk") @OrderColumn(name = "index") @Override public List<KostZuweisungDO> getKostZuweisungen() { return this.kostZuweisungen; }
@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; }
@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; }
@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; }
@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; }
@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; }
@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, orphanRemoval = true) @OrderColumn(name = "searchResultFieldIndex") @JoinColumn(name = "recordCollection_id", nullable = false) public List<SearchResultField> getSearchResultFields() { return searchResultFields; }
/** * 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; }
/** * 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; }
public static String resolveOrderColumn(ListAttribute<?,?> attr) { OrderColumn annotation = ((AnnotatedElement)attr.getJavaMember()).getAnnotation(OrderColumn.class); String specifiedValue = annotation.name(); return specifiedValue != "" ? specifiedValue : attr.getName() + "_" + "ORDER"; }
@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, orphanRemoval = true) @OrderColumn(name = "facetIndex") @JoinColumn(name = "recordCollection_id", nullable = false) public List<CollectionFacet> getCollectionFacets() { return collectionFacets; }
@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; }
@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; }
/** * 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; }