I like the idea of Named Queries in JPA for static queries I'm going to do, but I often want to get the count result for the query as well as a result list from some subset of the query. I'd rather not write two nearly identical NamedQueries. Ideally, what I'd like to have is something like:
@NamedQuery(name = "getAccounts", query = "SE...
I have a simple JPA @Entity that has a property of type
java.util.Locale.
When I try and persist this, I get the following error:
java.lang.IllegalArgumentException: locale: java.util.Locale is not a supported property type.
at com.google.appengine.api.datastore.DataTypeUtils.checkSupportedSingleValue( DataTypeUtils.java:174...
Hi,
I'm toying around with GWT (dunno if this matters) and Hibernate. I've created a a file persistence.xml in META-INF with (amoung) other configuration the line:
org.hibernate.ejb.HibernatePersistence
But when I startup the EntityManager it chooses DataNucleus instead of Hibernate (which later fails because it isnt installed (jar are ...
I have a JPA/Hibernate data model that I am using the Hibernate hbm2ddl tool to generate database DDL. I have some strings that should be CHAR and some that may be VARCHAR in the database. I want to minimize hand editing of the DDL (I realize that some will have to happen).
Anyone know how I should go about this? I realize that I can ma...
I'm exposing the following EJB3 stateless session bean through a web service.
@Stateless
public class UserRoleFacade implements UserRoleFacadeLocal {
@PersistenceContext(unitName = "SimpleEA-ejbPU")
private EntityManager em;
public int count() {
System.out.println("thisClass=" + this.getClass().getSimpleName() + "@"...
We have a batch application using OpenJPA. We are specifying all the DB connection parameters in persistence.xml. Although its a functional setup it looks very insecure to have all the ip,username,password in clear text and a serious concern in production.
As it is a standalone batch app we cant use server configurations etc. Is there a...
Why does the code below result in org.datanucleus.exceptions.NucleusUserException: Object Manager has been closed? The exception appears to be thrown at query.getResultList().
public final void removeUserTokens(final String username) {
final Query query = entityManager.createQuery(
"SELECT p FROM PersistentLogin p WHERE user...
I wonder, if there is any definition by JPA for the behavior, if you setting equals value for any property. I didn't find any words in the specification.
I've tested with TopLink Essentials and Hibernate, what happens if I load a entity from database and set the property with same value again.
@Entity
public class MyEntity {
@Id
@G...
We are using Apache Derby 10.5.3.0_1 and hbm2ddl with Hibernate 3.3.x
I get the following constraints error while pre-loading the SQL on an embedded derby database. If I remove the primary key(id) from the create table sql, it's able to create the table. Not sure what the problem is over here.
create table user_flow (id integer not nul...
With two users simultaneously using my simple app, I'm getting exception:
Error Code: 0
Call: SELECT ID, NAME, IMAGE FROM GameObjectTable ORDER BY ID ASC
Query: ReadAllQuery(referenceClass=GameObject sql="SELECT ID, NAME, IMAGE FROM GameObjectTable ORDER BY ID ASC")
Caused by: org.postgresql.util.PSQLException: There was In/Out error w...
Hi everyone,
In my current project I am using a 3rd party library which has no JPA annotations.
Can I persist objects from that library using JPA and external mappings?
Can you recommend a good example? So far I only found information on external XML-Mappings and JPA in the JSR220 spec which mostly states the structure of the mappings....
I have an application using Java servlets/JSP's. There are multiple clients using my app, however each client has a separate database. All the databases have the same schema. I would like to determine which database connection to use at the time when a user logs into the system.
For example client A logs in, I determine that client A b...
The JPA tutorial states that one can have a non-entity that extends entity class:
Entities may extend both entity and
non-entity classes, and non-entity
classes may extend entity classes. - http://java.sun.com/javaee/5/docs/tutorial/doc/bnbqa.html
Is it possible to persist such structure?
I want to do this:
@Entity
abstract...
Hi,
I've been trying to use polymorphic query with JPA (hibernate as provider) in the following domain scenario:
PriceTable (1) <--->(n) ItemPrice (n) <----> (1) Item
So for each PriceTable registered in my system I have a set of item prices which describe the price of a given item on that table. An item can be an Equipment or a Struc...
So, I have an web-based application that is using the Wicket 1.4 framework, and it uses Spring beans, the Java Persistence API (JPA), and the OpenSessionInView pattern. I'm hoping to find a security model that is declarative, but doesn't require gobs of XML configuration -- I'd prefer annotations.
Here are the options so far:
Spring S...
I am experiencing a problem with order by in a JPA-query. The query is trivial and behaves as expected in an sql-client. The problem is the swedish characters å, ä and ö (should be in that order). When running the query through JPA (Hibernate) å and ä are in the wrong order (ä,å,ö).
There is no difference between Oracle and HslqDB and n...
I am trying to persist an Entity with a @Lob annotated String field. The content of that fiels if bigger than the 40k buffer size limit.
The first problem I had was related to the setString method used internally by the JPA implementation (Hibernate in my case) and the Oracle JDBC Driver. This problem was solved adding
<property n...
In my spring/openjpa based application, I have two simple entities:
@Entity
public class Game {
@Id
@GeneratedValue
protected Long id;
@ManyToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE})
@JoinColumn(name = "target_id")
protected GameObject target;
...}
@Entity
public class GameObject {
@Id
@GeneratedValue
protected Long id;
@...
Hi,
I'm building an app using Hibernate 3 (with JPA Annotations), Spring 2.5 and Spring Security 2.0.5.
I want to know what I need to put in my <authentication-provider> tag in my spring security config file (applicationContext-security.xml) so that I can get Spring Security to use my existing Service layer class (AuthenticationService...
Hi guys,
With Hibernate I'm used to do something like the following:
select n from NetworkElement n join fetch n.site s where s.active is true
However, EclipseLink complains a lot about this:
Caused by: Exception [EclipseLink-8024] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): org.eclipse.persistence.exceptions.JPQLExcept...