How do you enable debug logging for OpenJPA when running an application in WebLogic 11g? I tried the steps given by http://stackoverflow.com/questions/792741/logging-jpa-sql-with-weblogic-10-3, but no OpenJPA log statements appear in the server log. I have also poured over the WebLogic documentation regarding the configuration of loggi...
I'm having an issue with a SELECT NEW query.
Query q = em.createQuery(
"SELECT NEW com.bcbst.odstats.ejb.RangeStats(a.folderName, SUM(a.hits)) " +
"FROM ODStat a GROUP BY a.folderName");
return q.getResultList();
I get the following stacktrace when I try to run this query. RangeStats does have public methods, ...
WARNING: see my own answer below. The problem is caused by old Oracle drivers that were present on the classpath in addition to 10.2.0.4. Problem solved. Leaving the rest of this question for posterity.
I've been banging my head against the following. Here's a simple POJO distilled from my application code:
@Entity
@Table(name = "PIGGI...
Hi,
Using auto update (hibernate.hbm2ddl.auto=update) I have a entity which is supppose to create two tables:
myentity and myentityconfigurationProperties.
This works fine in Mysql 5, but in SQL server 2005 it doesnt create the property table.
Anyone knows anything about this? I havn't tried creating the table myself, I'd like to avoid ...
I'm actually finishing a Desktop App That implements JPA for DB Communication. I Have a JPA Util class that does the following:
private EntityManagerFactory emf = new EntityManagerFactory();
emf = Persistence.getEntityManagerFactory("default");
This "default" value is defined for my persistence.xml contained in the META-INF source fol...
I am trying to use Envers on a project that also uses Hibernate and Spring - and I appreciate a lot the code reduction offered by HibernateTemplate.
I configured Envers under JPA, and after a few tweaks I was able to have the schema generated by the EnversHibernateToolTask Ant task (including the auditing tables). However, when I write ...
Hello,
I have two webapps, that are built together and respectively provide a client and admin access to a database.
I'd like to register two JPA EntityListeners to a given class, one in each app. To do that, I'm trying to find a way to register the listeners via the Spring XML configuration file that configure each app's JPA context.....
I have read the article Locking and Concurrency in Java Persistence 2.0, and run the sample application. But i still cant realize the difference between PESSIMISTIC_READ and PESSIMISTIC_WRITE. I tried to modify the code, and where the code using PESSIMISTIC_READ and PESSIMISTIC_WRITE will have the same result that the sql will invoked wi...
Hi,
with native SQL I get the database time with a statement like:
SELECT CURRENT_TIMESTAMP
with JPQL I get the same result with:
SELECT CURRENT_TIMESTAMP
FROM Customer c
WHERE c.id=1
Is there a way to get rid of the last two lines?
thanks,
...
Hi,
I'm a bit confused about a strange behavior of my JPA's related objects.
I have three bundle :
The User bundle does contain some user-related objects, but mainly the User object.
The Energy bundle does contain some energy-related objects, and particularly a ConsumptionTerminal which contains a List of User.
The Index bundle doe...
Let's say I've a table with 200 columns and most of them are never used.
I map SmallEntity to the 10 columns that are used often. I use it in the associations with other entities. It loads fast, consume few memory and makes me happy.
But sometimes I need to display the 200 columns. I'd like to map the BigEntity class on the 200 columns...
I'm new to this hibernate/jpa stuff so bear with me..
I've generated an entity bean and it works fine, but I would like to add some extra attributes to it and this causes hibernate to complain that the extra attributes aren't in the table's field list..
Is there a keyword to exclude these attributes from hibernate's query??
...
Hello all, I have banged my self with a very particular problem. Using OpenJPA (KODO 4.1) is there a way to use more than one column as a discriminator column?
My problem is that i have a table structure (which i have limited ability to modify of course) similar to this:
Table VEHICLE EXPENSIVE_CAR CHEAP_CAR EXPENSIVE_BOAT...
I have a perfectly working application client deployed to a glassfish v2 server inside an ear with some EJBs, Entities, etc. I'm using eclipselink.
Currently I have in my persistence.xml:
<persistence-unit name="mysource">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/mysource</jta-d...
i reverse engined entity class but the primary key is not anottaed with GeneratedValue . my table is created on oracle. do i need to add contraint on the table primary key for auto increment?
rightn ow i manually edit the entity and add generatedValue . looking for better solution . i think when reverse engine, it suppose to generate...
Hello,
I would like to know how we could use a sequence in JPA. We have a non-pk field which value must come from a sequence in DB. How could I update that value updating the entity?
Thanks in advance.
...
I want to use GenerationType.IDENTITY for primary keys in my production MySQL system. But for local development and testing, I'd like to use HSQLDB. The problem is that HSQLDB doesn't support GenerationType.IDENTITY (at least with Eclipselink). I tried setting GenerationType.AUTO, which defaults to TABLE for HSQLDB, but unfortunately it ...
I wan to get the value of only one week. I am using the following JPA query:
SELECT a
FROM questions.dao.hibernate.Questions a
WHERE (a.posted_date-CURRENT_DATE)>= 7
But I am getting an error message like
org.hibernate.QueryException: could not resolve property: posted_date of: questions.dao.hibernate.Questions [SELECT a FROM qu...
Methods invoked:
1. Struts Action
2. Service class method (annotated by @Transactional)
3. Xfire webservice call
Everything including struts (DelegatingActionProxy) and transactions is configured with Spring.
Persistence is done with JPA/Hibernate.
Sometimes the webservice will throw an unchecked exception. I catch this exception a...
I have an object "Instance" with another object "Course" inside. When trying to persist a new Instance object, I get the following error if Course is null:
java.lang.IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST: null
Here is my annotation for course:
...