I am trying to create a successful route for an entity that only has a composite key so that i may navigate to the default CRUD module's 'edit' interface.
Right now, I am successfully retrieving and displaying the list of all the club_admin's in the database, however when I try and navigate to the individual editing page of a club_admin, I receive the error of "no route."
The table in my database is:
create table club_admin (
club_id int not null,
user_username varchar(25) not null,
primary key (club_id,user_username),
constraint fk_club_admin_club_id foreign key (club_id) references club(club_id),
constraint fk_club_admin_user_username foreign key (user_username) references user(user_username)
);
The code for the club_admin class is:
package models;
...
@Entity
@Table(name="club_admin")
public class ClubAdmin extends GenericModel
{
@Id
@ManyToOne
@JoinColumn(name="club_id", referencedColumnName="club_id")
public Club club;
@Id
@ManyToOne
@JoinColumn(name="user_username", referencedColumnName="user_username")
public User user;
public ClubAdmin(Club club, User user)
{
this.club=club;
this.user=user;
}
...
}
My guess is that the table/entity has no default id to use for the route, and thus fails. So my questions is how do I create a route, that uses the composite keys to navigate to the 'edit' page of the club_admin, without having to create a single primary key of type integer?
Thanks!