Hi,
I am trying to get a simple example up and running using JPA in an EJB through GlassFish. I have the following persistence.xml
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com...
The Problem:
I have two complementary projects, a base one (Base Project) with shared entities and a specific one (Specific Project) that needs to query the entities from the first project.
They both access the same database, but in different schemes and different users/grants. Nonetheless, both have at least 'SELECT' grant on the shar...
I am working on Eclipse and I want to create an enterprise application using Glassfish and MySQL.
I created a Enterprise Application Project, with EJB and WEB modules, named WeatherEJB and WeatherWeb.
In the WeatherEJB project I generated entities from tables, using JPA and also I created a stateless remote session bean, called Country...
I am currently experimenting with JPA in a desktop application, while using BeansBinding to make the GUI development easier. So far the results are quite good.
As an example application I have a small DB with only one table. I successfully created the entity, the PU. Next I dropped a JTable into the main JFrame and bound it's columns to...
I'm working with many classes which are annotated with javax.persistence.Entity and the like. My project is about generating metadata about JPA-annotated classes rather than persistence by itself, so I'm using them as test cases.
Rather than firing up Hibernate or some other JPA provider, I'd like to programatically check - part of my u...
Hi
I m using glassfish v2 and persistence in a web application.
I m calling persistence codes using a normal java class file inside a web Application
I can select easily using this code: -
@PersistenceUnit
public EntityManagerFactory emf;
EntityManager em;
public List fname (String id) {
String fname = null;
List persons ...
The new release 1.3.1 of GAE has dropped the 1000 records limit:
No more 1000 result limit - That's
right: with addition of Cursors and
the culmination of many smaller
Datastore stability and performance
improvements over the last few months,
we're now confident enough to remove
the maximum result limit altogether.
Howe...
I'm running an application in JBoss and Using JPA.
For a report I need a group by query which I expect to return a result set with the following structure example:
count,idA,idB
I did not find a way to implement this in JPA.
What are my best options for implementing this considering I'm developing in JBoss 5, EJB3
...
public void addEmp(String emp_name, String emp_sal, String did) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("transactions-optional");
EntityManager em = emf.createEntityManager();
try {
String s = did;
EntityTransaction transaction = em.getTransaction();
transaction.begin...
I have doubt using jpa. I defined the datanucleus connection for MYSQL as follows.
datanucleus.ConnectionDriverName=com.mysql.jdbc.Driver
datanucleus.ConnectionURL=jdbc:mysql://localhost/myDB
datanucleus.ConnectionUserName=...
datanucleus.ConnectionPassword=..
My constraint is if I want to connect to google app engine datastore(ie Big...
I'm using DataNucleus as a JPA implementation to store my classes in my web application. I use a set of converters which all have toDTO() and fromDTO().
My issue is, that I want to avoid the whole DB being sent over the wire:
If I lazy load, the converter will try to access ALL the fields, and load then (resulting in very eager l...
I have followed a working JPA example to retrieve Category objects as such:
return (ArrayList<Category>) getEntityManager().createQuery("from Category").getResultList();
The query is very shorthand - and I can't find the rules for what is optional and what isn't in any of the guides. Is this brevity acceptable?
Secondly, I want to no...
I`m doing pagination, 2nd level cache is set up. Through hibernate+criteria it works fine, but through jpa
it works much more slower.
final String hql = "from Employee e "
+ "left join fetch e.positionedEmployees as p "
+ "left join fetch p.address as a "
+ "left join fetch p.comp...
NetBeans let me choose between three values for the JPA validation strategy: Auto, Callback and None. What does "Auto" mean? Does "Callback" mean the use of @PrePersist, @PreUpdate, and @PreRemove?
Is there a performance hit if I use Auto or Callback if there is no validation to perform?
...
I am trying to attach a related persisted entity to a transient entity. This works fine in GlassFish V2 but not in GlassFish V3. This is a very simple scenario. Please look at the testcase at QueryException when reading Property of detached Entity
Many thanks.
...
I need to delete millions of rows from a table from within an EJB Timer.
The problem is that the timer has a transaction timeout of 90 seconds, so I should divide the work into bite-size chunks.
Since I don't know how many rows can be deleted in 90 seconds the algorithm should loop and delete a few at a time until the time is almost up....
Hello everybody.
Consider the following simple example:
One team has many players and a player may only belong to one team.
@Entity
public class Team {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "team")
@Cascade({ org.hibernate.annotations.CascadeType.ALL,
org.hibernate.annotations.CascadeType.DELETE_ORP...
We are using Eclipselink and need to weave the code in order for lazy fetching to work property.
During the weave process I'm getting the following error:
weave:
BUILD FAILED
java.lang.OutOfMemoryError: PermGen space
I have the following tasks within my ant build file:
<target name="define_weave_task" description="task defin...
I'm just getting started with JPA, creating stateless session beans from the JPA entities, then accessing the beans through a web service. While I have a lot of experience developing database backed web services "the old way", I have some questions about what's going on behind the scenes with this new "annotation driven approach".
What...
Hi folks,
I'm trying to store a document as a BLOB in a java domain object that I have.
I've seen several posts saying it can be done using @Lob for example
http://www.java2s.com/Tutorial/Java/0355__JPA/MarkByteArrayFieldAsLob.htm
So, the problem I have is, when I store the data all seems fine, I can see it in my mysql database, howe...