persistence-unit

Multiple jars, single persistence unit solution?

送分小仙女□ 提交于 2019-12-02 16:45:19
Some people, including me, have been struggling with merging entities from different modules (jars) into a single persistence unit (especially with JavaSE , for instance here JPA 2.0: Adding entity classes to PersistenceUnit *from different jar* automatically ). Based on the answers there is no easy direct way to do that. One of solutions is to list all classes from all jars in single persistence unit file, but that's not really elegant. I might have accidentally found another way. Generally all my entity classes are mapped using annotations . As for the solution: persistence.xml can include

Spring-mvc-jpa with Maven error creating bean

我只是一个虾纸丫 提交于 2019-12-02 16:36:34
问题 This is my first question. I am new to Spring-MVC and Jpa, I am having this trouble and I couldn't figure it out my self.I tried searching on Google but didn't find something related to this error: I have stored all my configuration files under src/main/resources/META-INF and I am using Maven with STS. Apr 25, 2013 9:15:55 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring FrameworkServlet 'appServlet' Apr 25, 2013 9:15:56 PM org.apache.catalina.core

JPA - Using Multiple data sources to define access control

本小妞迷上赌 提交于 2019-12-01 12:27:06
I am totally new to JPA and JSF and hope you can help me with my questions. My application is built using JSF 2.0 Framework, using JPA 2.0/EclipseLink running on Glassfish 3+, MySQL. I set one persistence unit called "loginPU" using data source: "jdbc/loginDataSource" "jdbc/loginDataSource" connects to MySQL using "login1" (defined in mysql . user table) and only has access to customer . user and customer . roles tables, with only select privileges. I created 2 other data sources "jdbc/admin" and "jdbc/staff" in Glassfish JDBC Resources and both with different privileges The login

spring jpa hibernate with more datasources

自闭症网瘾萝莉.ら 提交于 2019-12-01 09:19:56
I have to use two different database in my application(spring) with Hibernate,Jpa. I'd like to define the different table directly to the different data sources. So I use two different persistence unit and I try to use <property name="packagesToScan" value="it.two.app.domain.first" /> and <property name="packagesToScan" value="it.two.app.domain.second" /> putting the different tables into the different packages. but It doesn't work. Infact all the table is with the first data source. then I tried to write into the perstistence XML file the name of the class like <persistence-unit name=

spring jpa hibernate with more datasources

泪湿孤枕 提交于 2019-12-01 06:32:02
问题 I have to use two different database in my application(spring) with Hibernate,Jpa. I'd like to define the different table directly to the different data sources. So I use two different persistence unit and I try to use <property name="packagesToScan" value="it.two.app.domain.first" /> and <property name="packagesToScan" value="it.two.app.domain.second" /> putting the different tables into the different packages. but It doesn't work. Infact all the table is with the first data source. then I

How can I merge / extend persistence units from different JARs?

不打扰是莪最后的温柔 提交于 2019-11-30 18:58:50
I use JPA persistence for my data models with Eclipselink as the persistence provider. I have a modular (OSGi) application and one of the modules contains the standard data model and a persistence unit that automatically includes all the entities from the package. The persistence provider is in another module, which works well. Now I want a third module to add some entities to the persistence unit. How do I do that? I found this solution , which seems specific to Spring which I'm not using. The summary of that approach is to write a post processor that hooks into the persistence unit

How to execute differnet import.sql in Hibernate/JPA for each persistence unit?

跟風遠走 提交于 2019-11-30 07:45:15
I have configured two persistence units in my JPA/Hibernate configuration. Now i need to execute different import.sql for each persistence unit. How can I specify which import.sql should be executed for each persistence unit? According Hibernate to documentation, I should place import.sql in classpath. If I do that, import.sql is executed on each persistence unit. I need somehow to specify different import.sql for each persistence unit. You could probably do something manual using the org.hibernate.tool.hbm2ddl.SchemaExport class when your application starts up. SchemaExport schemaExport1 =