Beginners questions

#1

Hello smiley !!

I am new in JPA / ObjectDB development and I have many questions:

 

1. General questions

1.1. If I understood correctly, ObjectDB is an implementation of JPA standard (currently 2.0)?
1.2. Is ObjectDB on the same level like Hibernate with only difference that Hibernate stores the data in a RDBMS and ObjectDB has its own format?

2. Object creation

I created a class named EBResult which looks like this:

@Entity(name="RESULT")
public class EBResult extends Pojo implements Serializable{.....

In ObjectDB-explorer (which is part of ObjectDB library) I expected to see an object named "RESULT" due to class annotation @Entity(name="RESULT"). 

2.1. Why? Is the @Entity(name="RESULT") ignored by ObjectDB?
2.2. Is the annotation @Entity(name="RESULT") relevant for ObjectDB in any way?

 

3. Object relationship

I try to create a 1->n relation (EBVerlag is 1 and EBUser is n) between two tables:

Table "EBVerlag":

@Entity(name="VERLAG")
public class EBVerlag extends Pojo implements Serializable {

private static final long serialVersionUID = 1L;
@Id @Column(name = "ID") @GeneratedValue(strategy = GenerationType.AUTO)  private Long id;
@OneToMany (fetch=FetchType.LAZY,cascade=CascadeType.ALL, mappedBy="VERLAG_ID") private List<EBUser> users;

Table "EBUser":

@Entity(name="USER")
public class EBUser extends Pojo implements Serializable{

private static final long serialVersionUID = 1L;
@Id @Column(name = "ID") @GeneratedValue(strategy = GenerationType.AUTO) private Long id;
@ManyToOne @Column(name = "VERLAG_ID") @JoinColumn(name="VERLAG_ID", insertable=false, updatable=false) private EBVerlag verlag=null;

3.1. Please take a look at column names and tell me, if I did the connection between these two tables correctly or not.

3.2. Both POJO-s extend my own class "Pojo.class" which looks like this:

public class Pojo {
private transient boolean changed=false;
public boolean isChanged(){
  return changed;
}
public void setChanged(boolean changed){
  this.changed = changed;
}

...as you can see, I tried to manage changes inside of the tables by the hand. So let's say: if I call a set-method of my POJO and the new value is different than the old value, then I call setChanged(true). Is there a better way to manage such changes (maybe automatically?). Please consider that I cannot use Spring or similar, because the test-project works inside of GWT-context.

#2

Please split this post to 3 separate threads:

  1. ObjectDB and JPA
  2. Entity name
  3. Relationships and tracking changes

You can post as many questions as you want, but please follow the posting instructions and use a separate thread for every logical subject.

ObjectDB Support
#3

I did, sorry angry

Reply