Is there any guide online on how to correctly map the sakila database using Java and hibernate?

41 views Asked by At

I need to create an application in which I can administer the sakila database, both as a staff member and as a customer. I can't seem to get the annotations a connections right, I get the same message for every single connection every time. It's like this:

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "alter table address modify column city_id integer" via JDBC [Referencing column 'city_id' and referenced column 'city_id' in foreign key constraint 'fk_address_city' are incompatible.]

There's more to it and they're all slightly different of course, I've been searching all over for just anything to point me in the right direction. Any tips appreciated.

I tried this mapping for Actor and Film:

@ManyToMany
    @JoinTable(
            name = "film_actor",
            joinColumns = @JoinColumn(name = "film_id"),
            inverseJoinColumns = @JoinColumn(name = "actor_id")
    )
    private Set<Actor> actors;

 @ManyToMany(mappedBy = "actors")
    private Set<Film> films;

I get this, amongst others:

Error executing DDL "alter table film_category modify column film_id integer not null" via JDBC [Referencing column 'film_id' and referenced column 'film_id' in foreign key constraint 'fk_film_category_film' are incompatible.]
0

There are 0 answers