Question

I have two tables named: t1, t2, t3.

      t1 consists of the following columns: id(PK), name
      t2 consists of the following columns: idPr(PK), id(FK), client
      t3 consists of the following columns: idF(PK), id(FK), idPr(FK), date

and these are the classes that I made:

 @PersistenceCapable 
 public class t1{

  @Persistent
  @PrimaryKey
  private String id;

  @Persistent
  private String name;

  ...

 }

 @PersistenceCapable 
 public class t2{


  @Persistent
  @PrimaryKey
  private String idPr;

  @Persistent
  private String id;


  @Persistent
  private String client;

       .......
 }


 @PersistenceCapable 
 public class t3{


  @Persistent
  @PrimaryKey
  private String idF;

  @Persistent
  private String id;

  @Persistent
  private String idPr;

  @Persistent
  private String date;

     ............
 }

How do I set the records about the foreign keys? I had a look here but I did not understand how to set them among the different classes.

Was it helpful?

Solution

I fail to see how you can have any "foreign keys" in that example since you have no relationships between classes. When you put in some relationships then foreign keys are created for you and the @ForeignKey is only to define the FK "name" and precise constraint details

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top