Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6120353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:39:31+00:00 2026-05-23T15:39:31+00:00

I have a problem with Spring and JPA. Basically I try to use JPA

  • 0

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:

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
             version="2.0">
    <persistence-unit name="fb-persistence" transaction-type="RESOURCE_LOCAL">  
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <class>it.synclab.fb.jpa.entity.Plugin</class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
            <!-- da utilizzare solo in caso di creazione dello schema <property name="hibernate.hbm2ddl.auto" value="create-drop"/>-->
            <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>  
            <property name="hibernate.show_sql" value="true"/>  
            <property name="hibernate.connection.username" value="flussibatch"/>  
            <property name="hibernate.connection.password" value="caposele"/>  
            <property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost:1521:XE"/> 
        </properties>
   </persistence-unit>
</persistence>

My applicationContext is:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
        <property name="persistenceUnitName" value="fb-persistence" />
    </bean>

    <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
    <bean name="pluginDao" class="it.synclab.fb.jpa.dao.impl.PluginDaoImpl" />
</beans>

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.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:39:31+00:00Added an answer on May 23, 2026 at 3:39 pm

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new in Spring Framework (2.5.6) and I have Hibernate integration problem on Glassfish
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have a Spring/JPA/Hibernate application and am trying to get it to pass my
I have a JPA/Spring application that uses Hibernate as the JPA provider. In one
I have a very weird problem. Have an application using Hibernate and spring.I have
My colleague and I have a web application that uses Spring 3.0.0 and JPA
We have implemented JUnit4 in our application which uses Spring core & JPA with
I have a problem with changing my spring/hibernate application from MySql to SQL Server.
I have a problem with my j2ee application using spring security. I set max-sessions
Being still a little unfamiliar with Spring, I have encountered a problem that makes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.