org.hibernate.annotations.Fetch.value()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(209)

本文整理了Java中org.hibernate.annotations.Fetch.value()方法的一些代码示例,展示了Fetch.value()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Fetch.value()方法的具体详情如下:
包路径:org.hibernate.annotations.Fetch
类名称:Fetch
方法名:value

Fetch.value介绍

暂无

代码示例

代码示例来源:origin: hibernate/hibernate-orm

if ( fetch.value() == org.hibernate.annotations.FetchMode.JOIN ) {
  toOne.setFetchMode( FetchMode.JOIN );
  toOne.setLazy( false );
  toOne.setUnwrapProxy( false );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SELECT ) {
  toOne.setFetchMode( FetchMode.SELECT );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SUBSELECT ) {
  throw new AnnotationException( "Use of FetchMode.SUBSELECT not allowed on ToOne associations" );
  throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() );

代码示例来源:origin: hibernate/hibernate-orm

if ( fetch.value() == org.hibernate.annotations.FetchMode.JOIN ) {
  collection.setFetchMode( FetchMode.JOIN );
  collection.setLazy( false );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SELECT ) {
  collection.setFetchMode( FetchMode.SELECT );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SUBSELECT ) {
  collection.setFetchMode( FetchMode.SELECT );
  collection.setSubselectLoadable( true );
  throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() );

代码示例来源:origin: stackoverflow.com

private void applyFetchMode(Root<T> root) {
  for (Field field : getDomainClass().getDeclaredFields()) {

    Fetch fetch = field.getAnnotation(Fetch.class);

    if (fetch != null && fetch.value() == FetchMode.JOIN) {
      root.fetch(field.getName(), JoinType.LEFT);
    }
  }
}

代码示例来源:origin: org.hibernate/hibernate-annotations

if ( fetch.value() == org.hibernate.annotations.FetchMode.JOIN ) {
  toOne.setFetchMode( FetchMode.JOIN );
  toOne.setLazy( false );
  toOne.setUnwrapProxy( false );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SELECT ) {
  toOne.setFetchMode( FetchMode.SELECT );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SUBSELECT ) {
  throw new AnnotationException( "Use of FetchMode.SUBSELECT not allowed on ToOne associations" );
  throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() );

代码示例来源:origin: se.vgregion.vertikala-prioriteringar/vertikala-prioriteringar-core-bc-composite-svc

boolean isFetchOfTypeJoinPresent(Field field) {
  Annotation annotation = field.getAnnotation(Fetch.class);
  if (annotation instanceof Fetch) {
    Fetch fetch = (Fetch) annotation;
    return FetchMode.JOIN == fetch.value();
  }
  return false;
}

代码示例来源:origin: org.hibernate/hibernate-annotations

if ( fetch.value() == org.hibernate.annotations.FetchMode.JOIN ) {
  collection.setFetchMode( FetchMode.JOIN );
  collection.setLazy( false );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SELECT ) {
  collection.setFetchMode( FetchMode.SELECT );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SUBSELECT ) {
  collection.setFetchMode( FetchMode.SELECT );
  collection.setSubselectLoadable( true );
  throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() );

代码示例来源:origin: stackoverflow.com

@Override
 protected <S extends T> TypedQuery<S> getQuery(Specification<S> spec, Class<S> domainClass, Sort sort) {
   CriteriaBuilder builder = em.getCriteriaBuilder();
   CriteriaQuery<S> query = builder.createQuery(domainClass);
   Root<S> root = applySpecificationToCriteria(spec, domainClass, query);
   query.select(root);
   applyFetchMode(root);
   if (sort != null) {
     query.orderBy(toOrders(sort, root, builder));
   }
   return applyRepositoryMethodMetadata(em.createQuery(query));
 }
 private void applyFetchMode(Root<? extends T> root) {
   applyFetchMode(root, getDomainClass());
 }
 private void applyFetchMode(FetchParent<?, ?> root, Class<?> clazz) {
   for (Field field : clazz.getDeclaredFields()) {
     Fetch fetch = field.getAnnotation(Fetch.class);
     if (fetch != null && fetch.value() == FetchMode.JOIN) {
       FetchParent<?, ?> descent = root.fetch(field.getName(), JoinType.LEFT);
       applyFetchMode(descent, field.getType());
     }
   }
 }

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

if ( fetch.value() == org.hibernate.annotations.FetchMode.JOIN ) {
  toOne.setFetchMode( FetchMode.JOIN );
  toOne.setLazy( false );
  toOne.setUnwrapProxy( false );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SELECT ) {
  toOne.setFetchMode( FetchMode.SELECT );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SUBSELECT ) {
  throw new AnnotationException( "Use of FetchMode.SUBSELECT not allowed on ToOne associations" );
  throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() );

代码示例来源:origin: org.hibernate.orm/hibernate-core

if ( fetch.value() == org.hibernate.annotations.FetchMode.JOIN ) {
  toOne.setFetchMode( FetchMode.JOIN );
  toOne.setLazy( false );
  toOne.setUnwrapProxy( false );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SELECT ) {
  toOne.setFetchMode( FetchMode.SELECT );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SUBSELECT ) {
  throw new AnnotationException( "Use of FetchMode.SUBSELECT not allowed on ToOne associations" );
  throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() );

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

if ( fetch.value() == org.hibernate.annotations.FetchMode.JOIN ) {
  toOne.setFetchMode( FetchMode.JOIN );
  toOne.setLazy( false );
  toOne.setUnwrapProxy( false );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SELECT ) {
  toOne.setFetchMode( FetchMode.SELECT );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SUBSELECT ) {
  throw new AnnotationException( "Use of FetchMode.SUBSELECT not allowed on ToOne associations" );
  throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() );

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

if ( fetch.value() == org.hibernate.annotations.FetchMode.JOIN ) {
  collection.setFetchMode( FetchMode.JOIN );
  collection.setLazy( false );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SELECT ) {
  collection.setFetchMode( FetchMode.SELECT );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SUBSELECT ) {
  collection.setFetchMode( FetchMode.SELECT );
  collection.setSubselectLoadable( true );
  throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() );

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

if ( fetch.value() == org.hibernate.annotations.FetchMode.JOIN ) {
  collection.setFetchMode( FetchMode.JOIN );
  collection.setLazy( false );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SELECT ) {
  collection.setFetchMode( FetchMode.SELECT );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SUBSELECT ) {
  collection.setFetchMode( FetchMode.SELECT );
  collection.setSubselectLoadable( true );
  throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() );

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

toOne.setUnwrapProxy( false );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SELECT ) {
  toOne.setFetchMode( FetchMode.SELECT );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SUBSELECT ) {
  throw new AnnotationException( "Use of FetchMode.SUBSELECT not allowed on ToOne associations" );
  throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() );

代码示例来源:origin: org.hibernate.orm/hibernate-core

if ( fetch.value() == org.hibernate.annotations.FetchMode.JOIN ) {
  collection.setFetchMode( FetchMode.JOIN );
  collection.setLazy( false );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SELECT ) {
  collection.setFetchMode( FetchMode.SELECT );
else if ( fetch.value() == org.hibernate.annotations.FetchMode.SUBSELECT ) {
  collection.setFetchMode( FetchMode.SELECT );
  collection.setSubselectLoadable( true );
  throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() );

相关文章