2014-05-13 2 views
3

JPA 및 Java 8 기능 프로그래밍에 매우 이상한 문제가 있습니다.기능적 운영자가 JPA를 중단시킵니다. (버그?)

저는 StudentPresentation 클래스를 가지며 그 관계는 양방향입니다. 모든 자바 7에서 잘 작동하지만, 난 그냥이 이 (볼이 비공개, 아무 세터가 없습니다) 작동 자바 (8)에

전환 :

public static void setAllVisible(boolean visible) { 
    for (Presentation presentation : new PresentationRepository().findAll()) { 
     presentation.visible = visible; 
    } 
} 

충돌 :

public static void setAllVisible(boolean visible) { 
    new PresentationRepository().findAll().forEach(x -> x.visible = visible);   
    //same for new PresentationRepository().findAll().stream().forEach(x -> x.visible = visible); 
} 

이 예외는 여러 번 적용됩니다.

Exception in thread "main" Local Exception Stack: 
Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException 
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: [email protected] 
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.EntityManagerSetupException 
Exception Description: Predeployment of PersistenceUnit [BachelorproefPU] failed. 
Internal Exception: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.ValidationException 
Exception Description: [class models.users.Student] uses a non-entity [class models.planning.Presentation] as target entity in the relationship attribute [field presentation]. 
    at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:127) 
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:107) 
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:177) 
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79) 
    at persistence.JPAEntityManager.getEntityManagerFactory(JPAEntityManager.java:45) 
    at models.repositories.Repository.<init>(Repository.java:23) 
    at models.repositories.UserRepository.<init>(UserRepository.java:15) 
    at main.DbInitializer.<init>(DbInitializer.java:27) 
    at main.DbInitializer.main(DbInitializer.java:23) 

persistence.xml이 올바로 구성되어 있는지 (Java 8없이 작동하기 때문에) 확실히 모든 클래스가 포함되어 있고 @Entity를 가지고 있습니다. 그것은 또한 학생 수업 아니에요, 왜냐하면 내가 그것을 주석 경우 오류가 다른 클래스를 제공하기 때문에.

이 문제의 원인은 무엇입니까? 어쩌면 컴파일 크래시가 발생하고 Oracle에 프로젝트를 보내달라고 요청할 수도 있습니다.

답변

관련 문제