About commit

forum_thread

problem when primary key value is zero

I am copying data from a postgres database to objectDB. Some of the rows in the postgres table were created by postgres DDL / SQL insert statements and so do not abide by all JPA rules and recommendations, in particular there are some primary keys with value == 0. These cause problems for objectDB, typically "JPA Unexpected argument as primary key". When using eclipselink, there is a workaround that can be added to persistence.xml like this: ... ; em. getTransaction ( ) . commit ( ) ;   em. close ( ) ...

 
forum_thread

Merge on detached entities

Hello, it is possible to merge detached entities? There are some attached entities which load from the database. The transaction is finished and the entities become detached. In a new transaction the fields of the detached entities will be changed and a merge by em.merge(entity) will be saved the entities. Can this works correctly? How are the rules of the merge process? Do the changed fields of the detached entity overwrite the fields in the database? Also changed fields which are set to null? #1 2017-09-19 09:54 Hello, it is possible to merge detached entities? There are some attached entities which load fro ...

 
forum_thread

Field in Generic Class not persisted?

Hi, I am trying to persist a class which is extended from an abstract class - but fields declared inside the abstract class are not persisted - is that expected? I assume it can be done b/c this field can be recovered after serialisation/deserialization. Here is an code to demonstrate the problem Thanks   ... ; em. getTransaction ( ) . commit ( ) ; em. clear ( ) ; ...

 
forum_thread

Should I be able to persist a JFrame (or gui components in general)?

    I did the following: 1. (using Netbeans 8.02 & last available java 7 sdk) I sort of follow your tutorial(s) while applying the ideas to a sample that came with the IDE called GUIFormExamples (under samples). ... ; em. getTransaction ( ) . commit ( ) ;   }   ... em.persist(a); em.getTransaction().commit(); System.out.println(a.pJTextField1.getText()); //did have text ...

 
forum_thread

mappedBy problem

If I put the mappedBy element to the @OneToMany, the owned side (the many side) will never persist ! for example @Entity public class Employee { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) public Long id; public String name; @OneToMany(targetEntity=Address.class,mappedBy="employee") public List<Address> addresses; }   @Entity... ) ; em. getTransaction ( ) . commit ( ) ; Actually, even if you do not set the ...

 
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: ... ; em. getTransaction ( ) . commit ( ) ;   Query query = em. ...

 
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 : ... ; em. getTransaction ( ) . commit ( ) ; em. close ( ) ; ...

 
forum_thread

Unable to persist fields in subclass

I have a superclass Person, with several fields I have a subclass Patient with additional fields. I can persist Patient, but CANNOT persist the fields in this subclass. Why is this? example code: package miscTests; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javax.persistence.Access; import javax.persistence.AccessType; import javax.persistence.MappedSuperclass; ... ; em. getTransaction ( ) . commit ( ) ;   em. close ( ) ...

 
forum_thread

Speed of queries that return many objects

Hi, I have a DB of 146MB - with 1_000_000 elements. Loading the contents (objectDB query in java) takes about 10sec. I am using a recent MacBook (SSD blabla - disk I/O speed is about 400MB/sec - according to blackMagicTest app for mac) - so I was expecting the query to take less than one sec (146/400 = 0.35sec.. + some overhead). I was wondering if this kind of speed is "normal", or if this is something I should investigate. Thanks EKK ... em. getTransaction ( ) . commit ( ) ; em. clear ( ) ; ...

 
forum_thread

Schema evolution & renamed/moved enum

Hello, I have an entity with an attribute of type enum say com.pkg1.MyEnum. I created a few instances of the class with this attribute of type com.pkg1.MyEnum. Now, I moved that enum to a different package and renamed it say com.pkg2.MyNewEnum. When I open my database again, the attribute is null. I don't seem to be able to use the <schema> tag in the config file because my enum is not an entity. What is a the proper way of handling the migration? Thanks, Farid  ... Yes, make the updates within an active transaction and commit. ObjectDB Support ObjectDB - Fast Object ...