jpa

JPA/ORM vs JDBC for performance limited machines

We are creating a small application that will be deployed to very limited machines. They have only 256mb of RAM. I would like to use JPA as it simplifies the code and removes the need for JDBC ResultSet code. However, will the overhead of JPA on such small machines be a factor? I am thinking of using Toplink at the moment, which comes i...

EJB and JPA and @OneToMany - Transaction too long?

Hello. I'm using EJB and JPA, and when I try to access PhoneNumber objects in phoneNumbers attribute of Contact contact, it sometimes take several minutes for it to actually return data. It just returns no phoneNumbers, not even null, and then, after some time, when i call it again, it magically appears. This is how I access data: for ...

WAS 6.1, JPA with JTA, Hibernate, Spring : data retrieval problem

I'm running an application with the following components: Oracle 9i WAS 6.1.0.23 with WS and EJB3 features pack JPA with Hibernate 3.3.2.GA as provider (with Hibernate-EntityManager 3.4.0) Spring transaction manager for WAS : UowTransactionManager (spring 2.5.6) Spring webflow with flow-managed persistence (2.0.8), i.e. the entity mana...

Using JSF, JPA and DAO. Without Spring?

Hi, till now i still worked with JSF and JPA without DAOs. Now i'd like to use DAOs. But how can i initialize the EntityManager in the DAO-Classes? public class AdresseHome { @PersistenceContext private EntityManager entityManager; public void persist(Adresse transientInstance) { log.debug("persisting Adresse inst...

Why are people continuing to use xml mapping files instead of annotations?

I've observed the strange fact (based on the questions in the hibernate tag) that people are still actively using xml files instead of annotations to specify their ORM (Hibernate/JPA) mappings. There are a few cases, where this is necessary: you are using classes that are provided, and you want to map them. you are writing an API, who...

JPA 2 in Jboss and criteria api

Is there a working JPA 2 implementation for JBoss server? Or maybe there is some additional extension that provides JPA 2's criteria api equivalent? ...

Setting createdBy and updatedBy in JPA entities automatically

Hi everyone, I'm working on a JPA (Hibernate implementation of), Spring and Stripes web app. I have a number of JPA entities that have the following fields in common for both audit and query purposes: createdBy - the user ID of the person who created the entity. createdOn - the date the entity was created updatedBy - the user ID of the...

Calling equals on an ArrayList After Serialization

I am hitting a strange problem in relation to equals on an object transported over RMI. This has been wrecking my head for a few days now and I was wondering if anyone can help shed some light on the Problem. I have a Garage Class (that is also a JPA entity in case its relevant) that I push to a java process called X over RMI (So this o...

JPQL: InnerSelect causes PersistenceException (HibernateException: Errors in named queries)

Hi I try to use an inner select, but get only the exception "HibernateException: Errors in named queries" The both JPA entities: public class A implements Serializable { @Id @Column(nullable = false) @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; } public class B implements Serializable { @Id @...

JPA inheritance using PostgreSQL

I'm using Seam and trying to organize inheritence among several entities using JPA. A Person entity should be a parent, User and Partner entities ought to be children. The chosen strategy of inheritance is SINGLE_TABLE. The Person entity is as follows: @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn( ...

JPA and PostqreSQL: long string persistence

Can anybody tell me how to persist long text using JPA (I use PostgreSQL)? Here's the way I defined a very long string in my class: @Lob private String body; However, this produces a field of type charactervarying(255) in the database. Furthermore, I've tried to use @Column annotation: @Column(columnDefinition="TEXT") private Stri...

JPA Multiple Persistence Unit bug

Hi folks, I'm trying to add one more database/schema/persistenceUnit in my project and I'm receiving the error: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single bean but found 2 I google/api allot and could not found why spring is complaining about my configuration. Here is part of my appl...

EclipseLink JPA @PreUpdate call not persisting

I ran into some similar questions on StackOverflow, tried the solutions, but did not find an answer. I am using a fairly common JPA strategy to set last modified times on some entities. Set up the columns and the fields, then tag a method with @PreUpdate and let it set them equal to the current time. The problem is that I can see in t...

Whats the difference between JPA and JDO specifications?

I have been using Hibernate ORM, which is an implementation of the JPA specification to manage relational data. I have also heard of the JDO specification that supposed to do the same (manage relational data). What are the fundamental differences between the two? Any code samples most appreciated. How does JDO integrate with other Java ...

Do gae datanucleus annotations modify our java code?

I placed this question in Google groups for gae java (http://groups.google.com/group/google-appengine-java/browse%5Fthread/thread/85dc9f10d7e12a3), but sometimes it takes a week for someone to bother answering a question and I feel I need to know the answer much quicker. We are advised to have our persistent fields accessible only thro ...

database sort vs. programmatic java sort

hi, I want to get data from the database(MySQL) by JPA, I wand it sorted by some column value, So, what is the best practice, to: Retrieve the data from the database as list of objects (JPA), then sort it programmatically using some java APIs. OR Let the database sort it by using a sorting select query. ?? thanx in advance ...

How to configure & package a simple Java app to uss JPA

I'm trying to learn JPA and I want create a simple Java command line app that will use JPA to query and update a database table. I mapped out the the simple code needed to do this. But I don't know how to configure the directory structure, where to place the persistence.xml file, packaging and so on. This is just a quick and dirty lea...

How to use JPA to connect to Derby

A related query I asked: http://stackoverflow.com/questions/1892089/how-to-configure-package-a-simple-java-app-to-uss-jpa I have a simple Derby database which I can connect to via EJBs hosted in WebLogic. Now I would like to connect to it from a command line Java app using JPA. So far this Java code + persistence.xml file is throwing...

Possible to get CMP for EJB entities without using session beans?

Newbie to EJB, exploring CMP and trying to figure out the angles... I'm using Weblogic 10.3. I've created entities, utilized them from a session bean via JPA and called the session bean from a command line app. This gave me CMP. When I tried to use the entities directly from a command line app via JPA without using the session bean, ...

Hibernate - ManyToOne - Save - org.hibernate.TransientObjectException:

While I try to save top level entity (using JPA), do I need to get the ManyToOne mapped entity freshly from database and set it or cannot I just set Id (of manyToOne mapped entity and save top level entity? When do not get fresh entity it throws: org.hibernate.TransientObjectException: Table structures we are using: DEPARTMENT(DEPARTME...