About Id

forum_thread

ClassCastException on SELECT NEW ... after UPDATE over Java RMI

Hi, we are using ObjectDB 2.5.4_04 on Linux. Our application, which uses ObjectDb as a DB, exposes a Java RMI interface which allows remote RMI clients to run JPQL queries on the DB. The application internally runs SELECT NEW ... queries. For example: ... . arunta . base . db . FileNameDTO ( r . id , r . fileName ) FROM RecordingMetaData AS r WHERE ... result of type 'NEW com.arunta.base.db.FileNameDTO(r.id, r.fileName)' (error 783) at ... result of type 'NEW com.arunta.base.db.FileNameDTO(r.id, r.fileName)' ...

 
forum_thread

Mapped (Inverse) LAZY @OneToMany vs. Unmapped LAZY @OneToMany

In the code example below (also attached) I would like to understand why I am able to print to console a lazy @OneToMany mapped field after a finding entity manager closes. There is a switch DO_VIEW_BEFORE_CLOSE, and when it is true the fields are accessed and output before the finding entity manager closes and as expected both a mapped @OneToMany list and an unmapped @OneToMany list are viewable: a.listA_mapped:[{A}[4]"ownedElement1", {A}[5]"ownedElement2"] a.listB_unmapped:[{B}[2]"b1", {B}[3]"b2"] ... ) . commit ( ) ; Long id = a. id ; em. close ( ) ;   em = ...

 
api-jpa

javax.persistence.MapsId

Designates a ManyToOne or OneToOne relationship attribute that provides the mapping for an EmbeddedId primary key, an attribute within an EmbeddedId primary key, or a simple primary key of the parent entity.(Annotation of JPA)

 
forum_thread

@Column( name = "columnName") doesn't work

I have created following entity class with custom fields @Entity public class AfwDataKey {    @Id    @GeneratedValue    @Column(name = "KEY_ID")    private long id;    private Long timestamp;    @ManyToOne    @Column(name = "KEY_DESCRIPTOR")    private AfwKeyDescriptor keyDescriptor; ... public class AfwDataKey { @ Id @ GeneratedValue @ Column ( name = "KEY_ID" ) private long id ; private Long timestamp ; ...

 
forum_thread

java.sql.Timestamp with milliseconds

Using JPA with other providers java.util.Date will not provide support to store milliseconds, this can usually be overcome using (see here http://docs.oracle.com/javase/1.5.0/docs/api/java/sql/Timestamp.html) @Id @Column(name = "STMP") @Temporal(TemporalType.TIMESTAMP) private Timestamp timestamp; However with ObjectDB the milliseconds are not being stored, as shown this is an ID field and I am encountering duplicate ID errors trying to create multiple entries in the same second. ... @Id @Column(name = "STMP") @Temporal(TemporalType.TIMESTAMP) private ... the milliseconds are not being stored, as shown this is an ID field and I am encountering duplicate ID errors trying to create multiple entries in the same second. How can ...

 
api-jpa

javax.persistence.AssociationOverrides

Used to override mappings of multiple relationship properties or fields.(Annotation of JPA)

 
forum_thread

EntityManager JPA or JDO impl and different behavior

Hi, I have an issue with the EntityManager. My persistance XML looks like: <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.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/xml/ns/persistence/persistence_2_0.xsd"> ... correctly. However if I use em.find(SomeObject.class, id) the map is NOT populated. I created a simple test to demonstrate this, ... change the fact that in my project the em.find(type, id) doesn't populate the nested map and in the test project it does. ...

 
issue

Super class' field access fails

I have a base class: public abstract class HotObject extends BaseObject {   private Integer activity;   protected HotObject() {     activity = 1;   }   public Integer getActivity() {     return activity;   }   public void setActivity(Integer activity) {     this.activity = activity;   } ... = 20 ; // percent // @ Id private String name ;   public HotTag ( ... fooled by NetBeans. It is complaining about the missing id field in the base class. But the code compiles nevertheless and works also. ...

 
forum_thread

LifeCycle Event with Embeddable classes

Hello, is there a way that lifecycle events like prepersist or preupdate are also fired for embeddable classes, not just for entities? My case looks as follows: ... public class Foo {   @ Id @ GeneratedValue private Long id ;   private String description ;   @ OneToMany ...

 
issue

Unexpected exception (Error 990) - Merge with no Transaction

I am frequently having an error when merging a detached object outside of a transaction. (Is this allowed? I am not trying to modify the object, just read data from it.) Here is a test case: ... static class A { @ Id @ GeneratedValue Long id ;   String value ;   A ( String ...