java类org.hibernate.annotations.OrderBy的实例源码

Series.java 文件源码 项目:ZawodyWeb 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Get the list of Problems
 */
// problemsPK
@OneToMany(mappedBy = "series", cascade = CascadeType.REMOVE)
@OrderBy(clause = "abbrev")
public List<Problems> getProblemss() {
    return this.problemss;
}
OrderDTO.java 文件源码 项目:replyit-master-3.2-final 阅读 42 收藏 0 点赞 0 评论 0
@CollectionOfElements
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="purchaseOrder")
@OrderBy (
        clause = "id desc"
)
public Set<OrderProcessDTO> getOrderProcesses() {
    return this.orderProcesses;
}
RoleDTO.java 文件源码 项目:replyit-master-3.2-final 阅读 33 收藏 0 点赞 0 评论 0
@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinTable(name = "permission_role_map",
           joinColumns = {@JoinColumn(name = "role_id", updatable = false)},
           inverseJoinColumns = {@JoinColumn(name = "permission_id", updatable = false)}
)
@OrderBy(clause = "permission_id")
public Set<PermissionDTO> getPermissions() {
    return this.permissions;
}
CompanyDTO.java 文件源码 项目:replyit-master-3.2-final 阅读 30 收藏 0 点赞 0 评论 0
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "company")
@OrderBy(
        clause = "status_id"
)
public Set<AgeingEntityStepDTO> getAgeingEntitySteps() {
    return this.ageingEntitySteps;
}
CompanyDTO.java 文件源码 项目:replyit-master-3.2-final 阅读 32 收藏 0 点赞 0 评论 0
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "entity")
@OrderBy(
        clause = "id"
)
public Set<ContactTypeDTO> getContactTypes() {
    return this.contactTypes;
}
EnumerationDTO.java 文件源码 项目:replyit-master-3.2-final 阅读 28 收藏 0 点赞 0 评论 0
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER, mappedBy="enumeration")
@Cascade( 
        value= org.hibernate.annotations.CascadeType.DELETE_ORPHAN
        )
@Fetch (FetchMode.SUBSELECT)
@OrderBy(clause="id")
@Valid
public List<EnumerationValueDTO> getValues() {
    return this.values;
}
NotificationMessageDTO.java 文件源码 项目:replyit-master-3.2-final 阅读 29 收藏 0 点赞 0 评论 0
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "notificationMessage")
@OrderBy(clause = "section")
@Fetch(FetchMode.JOIN)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public Set<NotificationMessageSectionDTO> getNotificationMessageSections() {
    return this.notificationMessageSections;
}
CollectionBinder.java 文件源码 项目:lams 阅读 37 收藏 0 点赞 0 评论 0
public void setJpaOrderBy(javax.persistence.OrderBy jpaOrderBy) {
    this.jpaOrderBy = jpaOrderBy;
}
CollectionBinder.java 文件源码 项目:lams 阅读 36 收藏 0 点赞 0 评论 0
public void setSqlOrderBy(OrderBy sqlOrderBy) {
    this.sqlOrderBy = sqlOrderBy;
}
CollectionBinder.java 文件源码 项目:lams 阅读 34 收藏 0 点赞 0 评论 0
private void applySortingAndOrdering(Collection collection) {
    boolean isSorted = isSortedCollection;

    boolean hadOrderBy = false;
    boolean hadExplicitSort = false;

    Class<? extends Comparator> comparatorClass = null;

    if ( jpaOrderBy == null && sqlOrderBy == null ) {
        if ( deprecatedSort != null ) {
            LOG.debug( "Encountered deprecated @Sort annotation; use @SortNatural or @SortComparator instead." );
            if ( naturalSort != null || comparatorSort != null ) {
                throw buildIllegalSortCombination();
            }
            hadExplicitSort = deprecatedSort.type() != SortType.UNSORTED;
            if ( deprecatedSort.type() == SortType.NATURAL ) {
                isSorted = true;
            }
            else if ( deprecatedSort.type() == SortType.COMPARATOR ) {
                isSorted = true;
                comparatorClass = deprecatedSort.comparator();
            }
        }
        else if ( naturalSort != null ) {
            if ( comparatorSort != null ) {
                throw buildIllegalSortCombination();
            }
            hadExplicitSort = true;
        }
        else if ( comparatorSort != null ) {
            hadExplicitSort = true;
            comparatorClass = comparatorSort.value();
        }
    }
    else {
        if ( jpaOrderBy != null && sqlOrderBy != null ) {
            throw new AnnotationException(
                    String.format(
                            "Illegal combination of @%s and @%s on %s",
                            javax.persistence.OrderBy.class.getName(),
                            OrderBy.class.getName(),
                            safeCollectionRole()
                    )
            );
        }

        hadOrderBy = true;
        hadExplicitSort = false;

        // we can only apply the sql-based order by up front.  The jpa order by has to wait for second pass
        if ( sqlOrderBy != null ) {
            collection.setOrderBy( sqlOrderBy.clause() );
        }
    }

    if ( isSortedCollection ) {
        if ( ! hadExplicitSort && !hadOrderBy ) {
            throw new AnnotationException(
                    "A sorted collection must define and ordering or sorting : " + safeCollectionRole()
            );
        }
    }

    collection.setSorted( isSortedCollection || hadExplicitSort );

    if ( comparatorClass != null ) {
        try {
            collection.setComparator( comparatorClass.newInstance() );
        }
        catch (Exception e) {
            throw new AnnotationException(
                    String.format(
                            "Could not instantiate comparator class [%s] for %s",
                            comparatorClass.getName(),
                            safeCollectionRole()
                    )
            );
        }
    }
}
CollectionBinder.java 文件源码 项目:lams 阅读 35 收藏 0 点赞 0 评论 0
private String extractHqlOrderBy(javax.persistence.OrderBy jpaOrderBy) {
    if ( jpaOrderBy != null ) {
        return jpaOrderBy.value(); // Null not possible. In case of empty expression, apply default ordering.
    }
    return null; // @OrderBy not found.
}
ListBinder.java 文件源码 项目:lams 阅读 33 收藏 0 点赞 0 评论 0
@Override
public void setSqlOrderBy(OrderBy orderByAnn) {
    if ( orderByAnn != null )
        LOG.orderByAnnotationIndexedCollection();
}
SetBinder.java 文件源码 项目:lams 阅读 36 收藏 0 点赞 0 评论 0
@Override
   public void setSqlOrderBy(OrderBy orderByAnn) {
    if ( orderByAnn != null ) {
           super.setSqlOrderBy( orderByAnn );
    }
}
OrderDTO.java 文件源码 项目:replyit-master-3.2-final 阅读 32 收藏 0 点赞 0 评论 0
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="purchaseOrder")
@OrderBy(clause="id")
public List<OrderLineDTO> getLines() {
    return this.lines;
}


问题


面经


文章

微信
公众号

扫码关注公众号