in Education by
I have a problem with Spring and JPA. Basically I try to use JPA with Spring with a pure approach, or better, without explicit references in the code to Spring framework with the exception of the @Transactional. So I wanted to know where wrong. My persistence.xml is: org.hibernate.ejb.HibernatePersistence it.synclab.fb.jpa.entity.Plugin true <!-- da utilizzare solo in caso di creazione dello schema <property name="hibernate.hbm2ddl.auto" value="create-drop"/>--> My applicationContext is: <?xml version="1.0" encoding="UTF-8"?> my DAO interface is: import it.synclab.fb.jpa.entity.Plugin; public interface PluginDao { public Plugin load (int id); public void save(Plugin plg); } and my implementation is: import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.springframework.transaction.annotation.Transactional; import it.synclab.fb.jpa.entity.Plugin; public class PluginDaoImpl implements PluginDao { private EntityManager entityManager; @PersistenceContext (unitName="fb-persistence") public void setEntityManager(EntityManager entityManager) { this.entityManager = entityManager; } @Override public Plugin load(int id) { return entityManager.find(Plugin.class, id); } @Override @Transactional public void save(Plugin plg) { entityManager.persist(plg); } } This is my "horror": Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: fb-persistence] Unable to configure EntityManagerFactory at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83) at it.synclab.fb.jpa.test.PluginTest.main(PluginTest.java:26) Caused by: javax.persistence.PersistenceException: [PersistenceUnit: fb-persistence] Unable to configure EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:378) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48) at org.springframework.orm.jpa.LocalEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalEntityManagerFactoryBean.java:92) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417) ... 12 more Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: it.synclab.fb.jpa.entity.StoreFileGet.idTransaction in it.synclab.fb.jpa.entity.Transaction.listStoreFileGet at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:685) at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:645) at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:65) at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1689) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1396) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1348) at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1522) at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:193) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1100) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:282) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:366) ... 18 more JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: it.synclab.fb.jpa.entity.StoreFileGet.idTransaction in it.synclab.fb.jpa.entity.Transaction.listStoreFileGet This means that in your entity you have an annotation like this @OneToMany(mappedBy="something") In this case, "something" has to be the name of the relevant field of the other entity.

Related questions

0 votes
    I'm trying to access my .xml file in the ClientBin with no success. code: WebClient xmlClient = ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    In my XSLT stylesheet I extract the value of the current month using a month-from-dateTime like this . ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    I have an XML with Text elements that can include tagged text and depending on the elements attribute value ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 13, 2022 in Education by JackTerrance
0 votes
    I have an XML and would like to : sort on employeeNumber, and for each bookingtime by year, month ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 29, 2022 in Education by JackTerrance
0 votes
    I'm using TensorFlow Alpha 2.0. I have TFRecords files I'm reading from, each one holding a short ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    I've created a seperate assembly with a class that is intended to be published through wmi. Then I' ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 24, 2022 in Education by JackTerrance
0 votes
    Visual Studio 2005 .Net Framework 2.0 I have the AjaxControlToolkit within my web application bin folder ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    I write the following code to access the page but this is not working for me if (User.Identity. ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    I write the following code to access the page but this is not working for me if (User.Identity. ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    I have followed through some of the threads discussing ouput escaping in XSLT but none seesm to address the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I have an XSLT like this: In the second template, which matches nodes in the fooDocument.xml which is ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I have followed through some of the threads discussing ouput escaping in XSLT but none seesm to address the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I have an XSLT like this: In the second template, which matches nodes in the fooDocument.xml which is ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
0 votes
    I am new to spring, as part of my project implementation, I am supposed to add a spring retry on ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 2, 2022 in Education by JackTerrance
...