About Id



Return the id of the entity.(Method of javax.persistence.PersistenceUnitUtil)


"Unsupported auto value type java.lang.String" when persisting new instance

I don't have a simple test case for this issue, but I'm getting this error: ... java.lang.String for field hr.hzmo.network.model.Device.ID (error 323) at com.objectdb.jpa.EMImpl.persist(EMImpl.java:378) at ... java.lang.String for field hr.hzmo.network.model.Device.ID at com.objectdb.o.MSG.d(MSG.java:61) at ...   I check and every object has a different ID. My annotations for primary key: @ Id @ ...


PostUpdate collection null

Hello, I have an entity MyEntity with a collection attribute myCollection. I have an EntityListener on MyEntity with a @PostUpdate method. When I try to access myCollection from the PostUpdate method, this collection is null. If I try to access the collection from the PreUpdate method, the collection is populated. The collection is eagerly fetched. public class MyEntity {     @OneToMany(fetch=FetchType.EAGER)     private ArrayList<OtherEntity> myCollection = new ArrayList<OtherEntity>(); ... static class MyEntity { @ Id int id ;   @ OneToMany ( fetch = ...


Rename Application StringIdentity

I don't think JDO supports altering an entity's Application Identity.  Does ObjectDB? @PersistenceCapable public class MyClass implements Serializable, Cloneable{ @Id private StringIdentity id; ... }   ... Serializable, Cloneable { @ Id private StringIdentity id ; ... }   PersistenceManager ... ) ) ; myPersistedClass. id = new StringIdentity ( "UniqueNew" ) ; ...


Problem with @UniqueConstraint

It seems there is a problem with @UniqueConstraint. Same annotations using hibernate works fine - an error will be thrown - duplicate name. ObjectDB - no exception will be thrown. with best regardsPeter... System. out . println ( "OK: " + ci. id + " " + ci2. id ) ; }   @ Entity @ ...


LAZY @ManyToOne field functions as EAGER

In the code example below (also attached) I would like to understand why I am able to print to console a lazy @ManyToOne field after the 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 LAZY @ManyToOne field and an EAGER @ManyToOne field are viewable: b.cLazy:{C}[2]"cLazy"
 b.cEager:{C}[3]"cEager" ... ) . commit ( ) ; Long id = b. id ; em. close ( ) ;   em = ...


Null returned by Persistence.createEntityManagerFactory

Hi, So I'm currently having an issue where createEntityManagerFactory returns null. When I run the application on the my local machine through Tomcat it works fine, the odb file is created.    ... Task implements Serializable { @ Id @ GeneratedValue int id ; //int id = 0; private String ticketNumber ; private ...


Intermittent: "Attempt to reuse an existing primary key value" when persisting a new instance

Hi,   I don't have a useful test case to expose this issue, but I am getting an intermittent "Attempt to reuse an existing primary key value". In this particular instance, the error is: ... was '1', but the actual last object created has an id of 168,000. I've inserted 168,000 objects of dummy data with an ... again of cleared up the issue. As I assign no ID's in my GUI - it seems that there could be a small bug? I'm using the following annotations for the id:   @ Id @ GeneratedValue ...


Criteria query error: Unexpected query token

Using JPA2, I can save entities now in JBoss, and also fetch them uniquely by id. However, if I try to fetch it by getting back all instances (e.g. findAll, I get the following error:   ... entities now in JBoss, and also fetch them uniquely by id. However, if I try to fetch it by getting back all instances (e.g. findAll, ... /** * Primary key for entity */ @ Id // @GeneratedValue(strategy = GenerationType.TABLE, generator = ...


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