2017-02-27 9 views
0

jboss7からwildfly10にプロジェクトを移行しています。奇妙なことは、jbossで生成されたクエリはwildfly10とは異なっているため、テーブル構造を変更する必要がありますが、期待されていません。JPA継承の問題、なぜ生成されたクエリがwildfly10とjboss7で異なるのですか

public class BaseAnnotation implements Serializable { 
    private static final long serialVersionUID = 6636704943305921427L; 
} 


@Entity 
@Table(name="one") 
@Inheritance(strategy=InheritanceType.SINGLE_TABLE) 
public class oneBaseAnnotation extends BaseAnnotation { 
@Id 
@GeneratedValue(generator = "baseAnnotationSequencer") 
@SequenceGenerator(name = "baseAnnotationSequencer", sequenceName = "BASEANNOTATION_SEQ") 
private Long id; 

private String annotationType; 
..... 
} 

@Entity 
public class TwoStructureAnnotation extends oneBaseAnnotation { 

private static final long serialVersionUID = -5838272604038154615L; 

@OneToMany 
@JoinTable(name= "CSA_CS") 
private List<TwoStructure> twoStructures = new ArrayList<TwoStructure>(); 

public TwoStructureAnnotation() { 
    setAnnotationType("Two Structure"); 
} 
..... 
} 

public class..... { 
    protected List<T> createQuery(int first, int pageSize, 
     List<SortMeta> multiSortMeta, Map<String, String> filters, 
     String joinField) { 
    // Setup 
    CriteriaBuilder cb = getObjectEntityManager().getCriteriaBuilder(); 
    CriteriaQuery<T> criteria = (CriteriaQuery<T>) cb.createQuery(); 
    Root<A> annotationRoot = criteria.from(TwoStructureAnnotation.class); 
    ListJoin<A, T> joinRoot = annotationRoot.joinList("twosStructures"); 
    Predicate restrictions = cb.conjunction(); 

    // Filter 
    filters.putAll(this.getBaseFilter()); 
    restrictions = cb.and(restrictions, 
      createGlobalFilter(filters, joinRoot, cb)); 

    restrictions = cb.and(restrictions, 
      cb.equal(annotationRoot, annotation)); 
    ... 
    // Query creation 
    criteria.where(restrictions); 
    criteria.select(joinRoot); 

    // Restrict Returns 
    TypedQuery<T> returnQuery = getObjectEntityManager().createQuery(
      criteria); 
    returnQuery.setFirstResult(first); 
    returnQuery.setMaxResults(pageSize); 

    List<T> results = returnQuery.getResultList(); 

    ....} 

以下のクエリ、テーブルCSA_CS上inner joinに重要という異なります。私はなぜ、私に示唆してください、ありがとう、分からない。 wildfly10でJboss7

​​

--in

---

select 
* 
from 
(select 
    crystalstr2_.id as id1_36_, 
    crystalstr2_.pdbEntry_id as pdbEntry_id3_36_, 
    crystalstr2_.title as title2_36_ 
from 
    ONE crystalstr0_ 
inner join 
    CSA_CS crystalstr1_ 
     on crystalstr0_.id=crystalstr1_.TWOStructureAnnotation_id 
inner join 
    TwoStructure crystalstr2_ 
     on crystalstr1_.crystalStructures_id=crystalstr2_.id 
where 
    crystalstr0_.DTYPE='TwoStructureAnnotation' 
    and 1=1 
    and 1=1 
    and crystalstr0_.id=?) 
where 
rownum <= ? 

テーブル:

答えて

0
table-TWOSTRUCTURE 
ID 
TITLE 

table-CSA_CS 
ONE_ID 
CRYSTALSTRUCTURES_ID 

table-ONE 
DTYPE 
ID 
ANNOTATIONTYPE 

JBoss7船の4.xを休止状態とwildfly 10に発送して5を休止休止状態5、Oracleは内部結合に実装されています。 Oracle10gDialectを使用する場合、 Oracle10gDialectはANSI結合のサポートを追加しました。サブクラス(Oracle12cDialectなど)はこの機能を継承します。

+0

ありがとうございます。問題は、今は別のサーバーのキーIDの名前は異なる列名を持っています。 2つのサーバー間で内部結合が同じです。 – fromdw

関連する問題