AnsweredAssumed Answered

Canvas Data save to MySQL tables without PK - Java

Question asked by Erick Benites on Jan 8, 2018
Latest reply on Jan 31, 2018 by James Jones

Greetings

I'm trying save data tables https://portal.inshosteddata.com/docs#wiki_page_fact into my mysql database using Java with Hibernate, and I dont have any problem with dimensions tables as course_dim:

@Entity
@Table(name = "course_dim")
public class CourseDim extends DataTable{

    @Id
    protected Long id;
    protected Long canvas_id;
    protected Long root_account_id;
    protected Long account_id;
    protected Long enrollment_term_id;
    protected String name;
    protected String code;
    protected String type;
    protected Date created_at;
    protected Date start_at;
    protected Date conclude_at;
    protected String publicly_visible;
    protected String sis_source_id;
    protected String workflow_state;
    protected Long wiki_id;
}

but when I trying save the facts table as "wiki_page_fact" i get a error message:

ERROR: there is no primary key for referenced table "wiki_page_fact"
@Entity
@Table(name = "wiki_page_fact")
public class WikiPageFact extends DataTable implements Serializable{

    protected Long wiki_page_id;
    protected Long wiki_id;
    protected Long parent_course_id;
    protected Long parent_group_id;
    protected Long parent_course_account_id;
    protected Long parent_group_account_id;
    protected Long user_id;
    protected Long account_id;
    protected Long root_account_id;
    protected Long enrollment_term_id;
    protected Long group_category_id;
    protected Long wiki_page_comments_count;
    protected Long view_count;
}

What would the primary key?

I would not know if I should insert or update a record. Or I should to remove all records from table and then insert all again.

 

Thanks so much

Outcomes