Java 无法根据路径解析属性[lieferungen]
我们在Maven测试中遇到了一个关键问题。 我们得到错误:无法根据路径解析属性[lieferungen] 不幸的是,其他帖子无法帮助我 这是我的堆栈跟踪:Java 无法根据路径解析属性[lieferungen],java,jakarta-ee,Java,Jakarta Ee,我们在Maven测试中遇到了一个关键问题。 我们得到错误:无法根据路径解析属性[lieferungen] 不幸的是,其他帖子无法帮助我 这是我的堆栈跟踪: Running de.shop.bestellverwaltung.service.LieferverwaltungTest Tests run: 4, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 36.446 sec <<< FAILURE! createLiefer
Running de.shop.bestellverwaltung.service.LieferverwaltungTest
Tests run: 4, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 36.446 sec <<< FAILURE!
createLieferung(de.shop.bestellverwaltung.service.LieferverwaltungTest) Time elapsed: 0.079 sec <<< ERROR!
java.lang.IllegalArgumentException: Unable to resolve attribute [lieferungen] against path
at org.hibernate.ejb.criteria.path.AbstractPathImpl.unknownAttribute(AbstractPathImpl.java:120)
at org.hibernate.ejb.criteria.path.AbstractPathImpl.locateAttribute(AbstractPathImpl.java:229)
at org.hibernate.ejb.criteria.path.AbstractFromImpl.fetch(AbstractFromImpl.java:595)
at de.shop.bestellverwaltung.dao.BestellungDao.findBestellungenByIds(BestellungDao.java:36)
at de.shop.bestellverwaltung.dao.BestellungDao$Proxy$_$$_WeldSubclass.findBestellungenByIds(BestellungDao$Proxy$_$$_WeldSubclass.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jboss.weld.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:84)
at org.jboss.weld.interceptor.proxy.InterceptorInvocationContext.proceed(InterceptorInvocationContext.java:127)
at de.shop.util.LogInterceptor.log(LogInterceptor.java:87)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jboss.weld.interceptor.proxy.SimpleMethodInvocation.invoke(SimpleMethodInvocation.java:30)
at org.jboss.weld.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:68)
at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:112)
at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:88)
at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:53)
at de.shop.bestellverwaltung.dao.BestellungDao$Proxy$_$$_WeldSubclass.findBestellungenByIds(BestellungDao$Proxy$_$$_WeldSubclass.java)
at de.shop.bestellverwaltung.service.BestellverwaltungImpl.createLieferung(BestellverwaltungImpl.java:194)
at de.shop.bestellverwaltung.service.BestellverwaltungImpl$Proxy$_$$_WeldSubclass.createLieferung(BestellverwaltungImpl$Proxy$_$$_WeldSubclass.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jboss.weld.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:84)
at org.jboss.weld.interceptor.proxy.InterceptorInvocationContext.proceed(InterceptorInvocationContext.java:127)
at de.shop.util.LogInterceptor.log(LogInterceptor.java:87)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jboss.weld.interceptor.proxy.SimpleMethodInvocation.invoke(SimpleMethodInvocation.java:30)
at org.jboss.weld.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:68)
at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:112)
at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:88)
at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:53)
at de.shop.bestellverwaltung.service.BestellverwaltungImpl$Proxy$_$$_WeldSubclass.createLieferung(BestellverwaltungImpl$Proxy$_$$_WeldSubclass.java)
at de.shop.bestellverwaltung.service.LieferverwaltungTest.createLieferung(LieferverwaltungTest.java:136)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
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.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:270)
at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
at org.jboss.arquillian.container.test.impl.execution.ContainerTestExecuter.execute(ContainerTestExecuter.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
这是我的域类Bestellung:
public class Bestellung implements java.io.Serializable {
private static final long serialVersionUID = -2703770025221749393L;
private static final String PREFIX = "Bestellung.";
public static final String FIND_BESTELLUNGEN_BY_KUNDE = PREFIX + "findBestellungenByKunde";
public static final String FIND_BESTELLUNG_BY_ID_FETCH_LIEFERUNG =
PREFIX + "findBestellungenByIdFetchLieferung";
public static final String FIND_KUNDE_BY_ID = PREFIX + "findBestellungKundeById";
public static final String PARAM_KUNDEID = "kundeId";
public static final String PARAM_ID = "id";
@Id
@GeneratedValue
@Column(name = "bid", unique = true, nullable = false, updatable = false, precision = LONG_ANZ_ZIFFERN)
@Min(value = MIN_ID, message = "{bestellverwaltung.bestellung.id.min}", groups = IdGroup.class)
private Long bid = KEINE_ID;
@OneToMany(fetch = EAGER, cascade = { PERSIST, REMOVE })
@JoinColumn(name = "bid_fk", nullable = false)
private List<Bestellposition> bestellpositionen;
@OneToMany(cascade = { PERSIST, REMOVE }, mappedBy = "bestellung")
private List<Lieferung> lieferung;
public类Bestellung实现java.io.Serializable{
私有静态最终长serialVersionUID=-2703770025221749393L;
私有静态最终字符串前缀=“Bestellung。”;
公共静态最终字符串FIND_BESTELLUNGEN_BY_KUNDE=前缀+“findBestellungenByKunde”;
公共静态最终字符串FIND_BESTELLUNG_BY_ID_FETCH_LIEFERUNG=
前缀+“findBestellungenByIdFetchLieferung”;
公共静态最终字符串FIND_KUNDE_BY_ID=PREFIX+“findBestellungKundeById”;
公共静态最终字符串PARAM_KUNDEID=“KUNDEID”;
公共静态最终字符串PARAM_ID=“ID”;
@身份证
@生成值
@列(name=“bid”,unique=true,nullable=false,updateable=false,precision=LONG_ANZ_ZIFFERN)
@Min(value=Min_ID,message=“{bestellverwaltung.bestellung.ID.Min}”,groups=IdGroup.class)
私人长期出价=KEINE_ID;
@OneToMany(fetch=EAGER,cascade={PERSIST,REMOVE})
@JoinColumn(name=“bid_fk”,nullable=false)
私人名单;
@OneToMany(cascade={PERSIST,REMOVE},mappedBy=“bestellung”)
列菲隆私人名单;
你还需要什么信息。我非常绝望。在这里坐了大约4天。你介意给我们看一下你在
de.shop.bestellverwaltung.dao.BestellungDao.findBestellungenByIds(…)中的代码吗
?-我认为Hibernate查询有问题。您的数据库中有列lieferungen
吗?-在Bestellung
中,我们有一个字段lieferung
(单数!)。。。
public class Bestellung implements java.io.Serializable {
private static final long serialVersionUID = -2703770025221749393L;
private static final String PREFIX = "Bestellung.";
public static final String FIND_BESTELLUNGEN_BY_KUNDE = PREFIX + "findBestellungenByKunde";
public static final String FIND_BESTELLUNG_BY_ID_FETCH_LIEFERUNG =
PREFIX + "findBestellungenByIdFetchLieferung";
public static final String FIND_KUNDE_BY_ID = PREFIX + "findBestellungKundeById";
public static final String PARAM_KUNDEID = "kundeId";
public static final String PARAM_ID = "id";
@Id
@GeneratedValue
@Column(name = "bid", unique = true, nullable = false, updatable = false, precision = LONG_ANZ_ZIFFERN)
@Min(value = MIN_ID, message = "{bestellverwaltung.bestellung.id.min}", groups = IdGroup.class)
private Long bid = KEINE_ID;
@OneToMany(fetch = EAGER, cascade = { PERSIST, REMOVE })
@JoinColumn(name = "bid_fk", nullable = false)
private List<Bestellposition> bestellpositionen;
@OneToMany(cascade = { PERSIST, REMOVE }, mappedBy = "bestellung")
private List<Lieferung> lieferung;