About EntityManagerFactory

forum_thread

Primary key generation problem after changing entity package

Hi, I changed package name for some of my entities in database. I added info in <schema><package... /></schema> of my configuration file - and the changes have been succesfully made in database. Unfortunately, sequences have been probably lost for changed entity classes. After schema change I keep getting errors : Attempt to reuse an existing primary key value... My primary keys are annotated as shown below : ... [ ] args ) { EntityManagerFactory emf = Persistence . ...

 
forum_thread

Possible issue with timestamps

Hi, If I query doing something like: select c from CDI c where c.creationDate > {ts '2012-03-29 11:00:00} and c.creationDate < {ts '2012-03-29 12:00:00'} the test fails. Its ONLY for 12:00:00. When I started digging I found that if I queried 00:00:00 to 00:25:00 and then did 12:00:00 to 12:25:00 I got IDENTICAL results. For some reason 12:00:00 is being treated the same as 00:00:00. All other hours seem to be fine. ... void test ( ) { EntityManagerFactory emf = Persistence . ...

 
forum_thread

Mapped By Fetch is very Slow

Well ! I think i pointed out a HUGE performance issue with mapped-by attribute (yeah again :( ). Here is the test case : 1- Create 100 000 entities with for each 1 entity with @OneToOne(mappedBy attribute) 2- Retrieve only 10 000 for testing 3- Wait ... On my AMD FX 8350, it took 60s Now, go the MyEntity class and remove "mapped-by". You obtain 1 second max of query fetch. ... [ ] args ) {   EntityManagerFactory emf = Persistence . createEntityManagerFactory ...

 
forum_thread

Optimistic locking: prevent version increment on entity collection attribute

Hello, I have an entity E with an attribute which is a collection of entities (one to many relationship) with an optimistic locking strategy supported by a version field. Is it possible to prevent the increment of the version of entity E when entities are added to or removed from the collection? Something like the equivalent of @OptimisticLock(excluded=true) in Hibernate? Thanks, Farid ... ) throws IOException { EntityManagerFactory emf = Persistence . createEntityManagerFactory ... ( ) throws IOException { EntityManagerFactory emf = Persistence . createEntityManagerFactory ...

 
forum_thread

Group by date / time

Hi, I'm trying to create reporting query that will return entities grouped by year / mont / day. Each entity has it's own field that holds java.lang.Date. There is no function like YEAR(), MONTH() or DAY() in ODB. So, how to build queries similar to something like this: SELECT COUNT(id) FROM stats WHERE YEAR(record_date) = 2009 GROUP BY YEAR(record_date), MONTH(record_date) or maybe something like this: ... [ ] args ) { EntityManagerFactory emf = Persistence . ...

 
forum_thread

Geospatial functions

Hi, is it possible to implement geospatial functions (e.g. calculating distance between too points given latitude/longitude) ?Normally you would calculate the distance like: ... ] args ) {   EntityManagerFactory emf = Persistence . ...

 
forum_thread

Filename.odb$ Persisting Issue

Hi, I seem to have a frequent issue with my Filename.odb$ remaining in my /db directory after my program terminates which prevents me from running my program again due to a persistence error thrown by Eclipse. I can't seem to manually terminate the file either. I usually have to fully close Eclipse and wait a bit for it to remove itself. Any ideas why this happens? Thanks, Dragon ... This may happen if the EntityManagerFactory (or PersistenceManagerFactory if you use JDO) is not ... If emf this is the only EntityManagerFactory instance in your application verify that emf.close ...

 
forum_thread

JPA JPQL WHERE clause for IN :variable not working if variable is a list of Enums

Hi, I have a case where I have a JPQL query like: "select o from MyEntity o WHERE (enumField IN :enumFieldList)" And enum field is defined in MyEntity as: @Enumerated(EnumType.STRING) @Column(nullable = false) @Index private MyEnumType enumField; And MyEnumType is defined as: public enum MyEnumType { VALUE1, VALUE2, VALUE3, VALUE4 } and I call: ... [ ] args ) { EntityManagerFactory emf = Persistence . ...

 
api-jpa

javax.persistence.spi.PersistenceProvider

Interface implemented by the persistence provider.(Interface of JPA)

 
forum_thread

Calendar in Criteria Querys

Hi, i am having troubles creating criteria querys for Calendar objects. As far as I can see CriteriaBuilder has no methods for checking if one Calendar is bevor or after another. Javas Calendar Class got such methods, but i dont know how to use those in my query. ... [ ] args ) { EntityManagerFactory emf = Persistence . ...