-1

Joined Column プロパティでデータをフェッチするときに例外を取得する:

My Java Code:

@Entity
public class CustomizedProfile {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Integer id;

        @ManyToOne(fetch=FetchType.EAGER)
    public ApplicationProfile applicationProfile;




@OneToMany
         @JoinColumn(name="custprofileNumcomm_id") 
         public List<UIAnyFieldTemplate> numCommUIList; 

    @OneToMany
        @JoinColumn(name="custprofilePOS_id") 
    public List<UIAnyFieldTemplate> posUIList;

    @OneToOne
    public Customer customer;

    public Integer getId() {
        return id;
    }

    public ApplicationProfile getApplicationProfile() {
        return applicationProfile;
    }

    public void setApplicationProfile(ApplicationProfile applicationProfile) {
        this.applicationProfile = applicationProfile;
    }

    public Customer getCustomer() {
        return customer;
    }
    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public List<UIAnyFieldTemplate> getNumCommUIList() {
        return numCommUIList;
    }

    public void setNumCommUIList(List<UIAnyFieldTemplate> numCommUIList) {
        this.numCommUIList = numCommUIList;
    }

    public List<UIAnyFieldTemplate> getPosUIList() {
        return posUIList;
    }

    public void setPosUIList(List<UIAnyFieldTemplate> posUIList) {
        this.posUIList = posUIList;
    }


}

UIAnyFieldTemplate.Java
=========================

@Entity
public class UIAnyFieldTemplate implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer id;

    }

My DAO Method:
===============

public List<UIAnyFieldTemplate> getDynamicMIDUIAnyFieldList(
            Integer customerId, String appName) throws AtlasDAOException {
        Session session = hibernateUtil.getSession();
        List<UIAnyFieldTemplate> uiAnyFieldTemplates = null;
        Query query1 = session
                .createQuery(" select cp.numCommUIList from CustomizedProfile cp WHERE cp.applicationProfile.appName="
                        + "'"
                        + appName
                        + "'"
                        + " and cp.customer.customerId="
                        + customerId +" and cp.custprofileNumcomm_id=cp.id");
        uiAnyFieldTemplates = (List<UIAnyFieldTemplate>) query1.list();
        return uiAnyFieldTemplates;
    }

org.hibernate.QueryException: could not resolve property: custprofilenumcomm_id of: com.ingenico.atlas.axis.profile.service.UIAnyFieldTemplate [ select cp.numCommUIList from com.ingenico.atlas.axis.profile.service.CustomizedProfile cp, com.ingenico.atlas.axis.profile.service.UIAnyFieldTemplate as ut WHERE cp.applicationProfile.appName='EMV FR' and cp.customer.customerId=10022 and ut.custprofilenumcomm_id=cp.id]
    at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:81)
    at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:75)
    at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1451)
    at org.hibernate.hql.ast.tree.FromElementType.getPropertyType(FromElementType.java:312)
    at org.hibernate.hql.ast.tree.FromElement.getPropertyType(FromElement.java:487)
    at org.hibernate.hql.ast.tree.DotNode.getDataType(DotNode.java:611)
    at org.hibernate.hql.ast.tree.DotNode.prepareLhs(DotNode.java:263)
    at org.hibernate.hql.ast.tree.DotNode.resolve(DotNode.java:210)
    at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:117)
    at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:113)
    at org.hibernate.hql.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:867)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1323)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4385)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3858)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1909)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1837)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:824)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:610)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:294)
    at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:237)
    at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
    at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
    at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
    at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
    at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
    at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:98)
    at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
    at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
    at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1760)
    at com.ingenico.atlas.dao.cardpayment.UIAnyFiledDAO.getDynamicMIDUIAnyFieldList(UIAnyFiledDAO.java:90)
    at com.ingenico.atlas.dao.cardpayment.UIAnyFiledDAO$$FastClassByCGLIB$$d416f474.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:689)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
    at com.ingenico.atlas.dao.cardpayment.UIAnyFiledDAO$$EnhancerByCGLIB$$8967d76f.getDynamicMIDUIAnyFieldList(<generated>)
    at com.ingenico.atlas.dao.cardpayment.UIAnyFieldDAOTest.getNumCommUIAnyFieldListTest(UIAnyFieldDAOTest.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:717)
    at org.springframework.test.context.transaction.TransactionalTestExecutionListener$TransactionContext.endTransaction(TransactionalTestExecutionListener.java:522)
    at org.springframework.test.context.transaction.TransactionalTestExecutionListener.endTransaction(TransactionalTestExecutionListener.java:293)
    at org.springframework.test.context.transaction.TransactionalTestExecutionListener.afterTestMethod(TransactionalTestExecutionListener.java:186)
    at org.springframework.test.context.TestContextManager.afterTestMethod(TestContextManager.java:406)
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:91)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
4

1 に答える 1

0

CustprofileNumcomm_id は CustomizedProfile のプロパティではないため、cp.CustprofileNumcomm_id を書き込むことはできません。

別のエンティティの列です。

この列を使用するには、子エンティティのプロパティを記述する必要があります。

于 2013-03-25T12:13:11.840 に答える