openjpa

Does OpenJPA work well with Glassfish?

半城伤御伤魂 提交于 2019-12-19 21:19:11
问题 Is anyone successfully using OpenJPA with Glassfish? I'm trying to use OpenJPA 2.1 with Glassfish 3.1 Open Source. I've followed the instructions to integrate the two here -> http://weblogs.java.net/blog/ss141213/archive/2006/07/using_openjpa_a.html I have a very simple EJB project in Eclipse Indigo with the following: com.rares.test.Person - @Entity com.rares.test.PersonManager - interface com.rares.test.PersonDao - @Stateless However, when I try to deploy I get a ClassNotFoundException on

why EntityManager is null?

江枫思渺然 提交于 2019-12-18 23:39:08
问题 In my web applicaton I use OpenJPA on Apache Tomcat (TomEE)/7.0.37 server. I use Netbeans to auto generate class ("Entity Class from database..." and "Session Beans From Entity Class..."). At SessionBean (for example UserFacade) i want to get EntityManager: @Stateless public class UserFacade extends AbstractFacade<User> { @PersistenceContext(unitName = "CollDocPU") private EntityManager em; @Override protected EntityManager getEntityManager() { return em; } } but when i get it by above way I

why EntityManager is null?

帅比萌擦擦* 提交于 2019-12-18 23:39:08
问题 In my web applicaton I use OpenJPA on Apache Tomcat (TomEE)/7.0.37 server. I use Netbeans to auto generate class ("Entity Class from database..." and "Session Beans From Entity Class..."). At SessionBean (for example UserFacade) i want to get EntityManager: @Stateless public class UserFacade extends AbstractFacade<User> { @PersistenceContext(unitName = "CollDocPU") private EntityManager em; @Override protected EntityManager getEntityManager() { return em; } } but when i get it by above way I

To initialize or not initialize JPA relationship mappings?

孤街醉人 提交于 2019-12-18 18:53:52
问题 In one to many JPA associations is it considered a best practice to initialize relationships to empty collections? For example. @Entity public class Order { @Id private Integer id; // should the line items be initialized with an empty array list or not? @OneToMany(mappedBy="order") List<LineItem> lineItems = new ArrayList<>(); } In the above example is it better to define lineItems with a default value of an empty ArrayList or not? What are the pros and cons? 回答1: JPA itself doesn't care

JPA Implementations - Which one is the best to use? [closed]

泪湿孤枕 提交于 2019-12-17 15:46:55
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I have made use of the following JPA implementations: Hibernate, Toplink, OpenJPA Each of them has their own strengths and weaknesses.

What is referencedColumnName used for in JPA?

只愿长相守 提交于 2019-12-17 07:10:42
问题 In JPA there is an attribute called referencedColumnName that can be set on @JoinColumn, @PrimaryKeyJoinColumn what is the idea behind this setting, can someone give a good example of where this can be used? 回答1: It is there to specify another column as the default id column of the other table, e.g. consider the following TableA id int identity tableb_key varchar TableB id int identity key varchar unique // in class for TableA @JoinColumn(name="tableb_key", referencedColumnName="key") 回答2:

How to use Postgres inet data type with OpenJPA?

你说的曾经没有我的故事 提交于 2019-12-14 02:14:50
问题 I need to record IP addresses in a Postgres (9.0) table with OpenJPA (2.2.2). I've got it working using a native query: EntityManager entityManager = entityManagerFactory.createEntityManager(); entityManager.getTransaction().begin(); int rows = entityManager.createNativeQuery("insert into click (ip) values (?::inet)") // .setParameter(1, InetAddress.getLocalHost().getHostAddress()) // .executeUpdate(); entityManager.getTransaction().commit(); entityManager.close(); But I'd prefer to figure

Websphere can't find my Hibernate-managed EntityManager

狂风中的少年 提交于 2019-12-14 00:33:56
问题 I'm using Hibernate 3.4 on Websphere 7, with Spring 2.5.6 On startup, my application seems to have problems with Hibernate vs. OpenJPA: 10/02/12 10:41:50:448 GMT] 00000010 LocalEntityMa I org.springframework.orm.jpa.LocalEntityManagerFactoryBean createNativeEntityManagerFactory Building JPA EntityManagerFactory for persistence unit 'mypu' [10/02/12 10:41:50:495 GMT] 00000010 SystemErr R WARNING: Found unrecognized persistence provider "org.hibernate.ejb.HibernatePersistence" in place of

Prevent unwanted cascaded table updates

↘锁芯ラ 提交于 2019-12-13 18:41:55
问题 I am creating my first JPA based project. My application features several tables with foreign key relationships for integrity purposes. Many related tables are normalized lookup tables. Consider the tables Person and Account , having a fk relationship on accountid : +-Person----+ | personid | +-Account---+ | accountid*|==============>| accountid | | ... | | ... | +-----------+ +-----------+ In the front end (JSF), I created a form for new Person objects containing a selectOneMenu list with

Which JPA providers are supported by Apache Aries Managed JPA?

安稳与你 提交于 2019-12-13 17:06:23
问题 OpenJPA, obviously. I've also seen EclipseLink and Hibernate mentioned, but is there significant difference in capabilities? 回答1: Most differences come from how OSGi-aware the provider is. For example, you may need to wrap the Hibernate jars as OSGi bundles yourself (or use a set someone else has already wrapped - there are a few floating around on the web). Occasionally providers try and do classloading in such a way that it won't work in an OSGi environment, so this is something to look out