Sorry for the noob question, but I'm having problems with JPA+Hibernate so I thought that something is not clear in my mind.
I have some entities, say A, B, C, D and I have coded AMethods, BMethods, CMethods, DMethods. Each of the *Methods classes contain EntityManager initialization via EntityManagerFactory and some methods that basica...
Hi. I would like to get your input on what would be the most fitting view layer for EJB 3.0 [1] Java application for me.
JSF is no good because it is a mess when it comes to web URIs. I would like a view framework which would help with automating html form submission and validation while using clean URIs like example.com/story/1 or exam...
I have a Message object associated with a User object (user_from and user_to). I persist the Message instances into a database using Hibernate (with JPA annotations) and the user_id is persisted.
The User object is also stored to the database, but when fetching messages I would like the User to be fetched from a Map in memory instead of...
Is it possible to do a nested select in JPA QL?
How would I write the following SQL statement in JPA QL?
select * from preferences p left outer join (select * from preferencesdisplay where user_id='XXXX') display on ap.pref_id=display.pref_id;
The JPA entity PREFERENCES has a OneToMany relationship to PREFERENCESDISPLAY. I want to...
Hi,
i was wondering whether it is possible to find an object using an example object like you can in hibernate with:
Cat cat = new Cat();
cat.Sex = 'F';
cat.Color = Color.Black;
List results = session.CreateCriteria(typeof(Cat)).Add( Example.Create(cat)).List();
I know i can find by primary key, just not looking forward to writing a ...
I have to test some things on a project which has been developed by others, but is new to me.
They are using Hibernate as a JPA implementation.
I got a virtual machine in which everything is set up, but when I want to start any Testclient (small console programs, no Unittesting). I always get the same error.
Exception in thread "main"...
Basically, I want a way to access sequence values in a database-neutral way.
The use case is that I have a field on an entity that I want to set based on an incrementing value (other than the id).
For instance, say I have a Shipment entity. At some point after the shipment gets created, it gets shipped. Once it gets shipped, a manife...
What does the CascadeType.REFRESH actually do? The definition for it is "When we refresh an entity all the entities held in this field refresh too", but what does this mean in practice? Could someone please give me a simple example?
...
When trying to setup a lock (pessimistic), with the following code:
em.lock(controlnumbers, LockModeType.WRITE);
em.refresh(controlnumbers);
I am getting the following exception:
[#|2009-09-10T15:42:48.324-0400|INFO|sun-appserver2.1|javax.enterprise.system.container.ejb|_ThreadID=31;_ThreadName=httpSSLWorkerThread-8080-19;|
javax.ejb...
Hi guys,
I'm in doubt about using roles for different scopes for my seam components. For example:
My project has a table called Parameter that stores all global parameters for the project as URLs, admin e-mail and etc ... For this table there is a simple CRUD interface for administration.
So, reading the seam 2.1.2 documentation i un...
Hello all,
I need to create project in which there are two databases local and remote. Remote database needs to be synchronized daily with local database reflecting changes made in local database.
I am using JAVA. Database is ORACLE. I have JAVA/JPA code that does CRUD operations on local database.
How to synchronize changes to remote da...
Hello Everyone
I have a problem with my jpa domain model. I am just trying to play around with simple inheritance for which I use a simple Person base-class and and a Customer subclass. According to the official documentation (both, JPA and EclipseLink) I only need the ID-attribute/column in the base-class. But when I run my tests, I al...
Hi,
I would like to know if there are any tools to automatically generate EJB3 Entity Beans(for JPA) from a database schema.
Thanks.
...
I want to develop my project on Google App Engine with Struts2. For the database I have two options JPA and JDO. Will you guys please suggest me on it? Both are new for me and I need to learn them. So I will be focused on one after your replies.
Thanks.
...
Hi,
I'm getting started with JPA and created the following (simplified) tables;
airport
--------
id (pk)
city
code
...
trip
--------
id (pk)
originAirport_id (fk)
destinationAirport_id (fk)
...
I'm trying to map this in JPA/Hibernate.
In My trip object I created 2 airport objects:
private Airport airportFrom;
private Airport ai...
I am writing web application and am wondering what the recommended way is to populate initial data. This is JPA/Hibernate and Spring application and is built by maven. Up to now I've used script wich populate database with initial data, started by hand.
Unit tests work with theirs own data, created in code before each test. My test clas...
What is the best practice in using JPA Entities?
Since JPA entities are just POJOs, is it considered appropriate to use the object as a data object in other parts of the system or should I convert them to another data object?
Is it acceptable to use the JPA Entity POJOs in other parts of the system unrelated to JPA?
...
Hey Guys
We're using hibernate entitymanager to map our entities through JPA. And we are using HSQLDB in-memory database for unit testing. Everything was fine until a recent refactor to the model started causing the following error:
17:55:48.516 [main] WARN o.h.util.JDBCExceptionReporter - SQL Error: -22, SQLState: S0002
17:55:48.517 ...
In this application we are developing, we noticed that a view was particularly slow. I profiled the view and noticed that there was one query executed by hibernate which took 10 seconds even if there only were two object in the database to fetch. All OneToMany and ManyToMany relations were lazy so that wasn't the problem. When inspecting...
Hello all I have a simple Spring application which will not end as there is still a reference left to org.enhydra.jdbc.pool.PoolKeeper. I include all the references I feel are revelant below does it look ok and has anyone experienced this before?
I ran jstack to see what non daemon threads where running and found the following.
"Threa...