我们的 Maven 测试中有一个关键问题。我们收到错误:无法针对路径解析属性 [lieferungen]
不幸的是,其他帖子无法帮助我。
这是我的堆栈跟踪:
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)
这些是我的域类(Lieferung):
public class Lieferung implements java.io.Serializable {
private static final long serialVersionUID = -2297631209213102849L;
private static final String PREFIX = "Lieferung.";
public static final String FIND_LIEFERUNGEN_BY_LIEFERNR_FETCH_BESTELLUNGEN =
PREFIX + "findLieferungenByLieferNrFetchBestellungen";
public static final String PARAM_LIEFERNR = "lieferNr";
@Id
@GeneratedValue
@Column(name = "lid", unique = true, nullable = false, updatable = false, precision = LONG_ANZ_ZIFFERN)
private Long lid;
@Column(nullable = false)
@Temporal(TIMESTAMP)
private Date aktualisiert;
@Column(nullable = false)
@Temporal(TIMESTAMP)
private Date erzeugt;
@Column
@Temporal(TIMESTAMP)
private Date lieferungsdatum;
@ManyToOne
@JoinColumn(name = "bestellung_fk")
private Bestellung bestellung;
这是我的域类 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;
您还需要什么信息。我很绝望。在这里坐了大约4天。