About Id


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)' ...


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 = ...



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)


@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 ; ...


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 ...



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


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. ...


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. ...


java.sql.Timestamp.getTime() not working

Hi, I need to work with Timestamp diff in two entity fields, but this queries SELECT count(p) FROM Player p WHERE p.loginAt.getTime()-p.registeredAt.getTime()>:value SELECT p.loginAt.getTime() FROM Player p fails with object is not an instance of declaring class but SELECT p.loginAt.getYear() FROM Player p works. How that possible?   ... Entity public class Player { @ Id @ GeneratedValue ( strategy = ... . IDENTITY ) public int id ; @ Temporal ( TemporalType . TIMESTAMP ) ...



(Optional) The amount to increment by when allocating id numbers from the generator.(Annotation Element of javax.persistence.TableGenerator)