package models;

import models.base.BaseModel;
import play.db.jpa.JPA;


import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import java.util.Date;

/**
 * Created by richard on 01.07.15.
 */
@Entity
public class Token extends BaseModel {

    @ManyToOne
    public Client client;

    @ManyToOne
    public Account user;

    public String accessToken;

    public Date expires;

    @Override
    public void create() {
        JPA.em().persist(this);
    }

    @Override
    public void update() {

    }

    @Override
    public void delete() {

    }
}

@@ -66,16 +66,49 @@
 .JPA;%0A%0A%0A
+import javax.persistence.Column;%0A
 import j
@@ -366,16 +366,41 @@
  user;%0A%0A
+    @Column(unique=true)%0A
     publ

Set accessToken to be unique.