Chaster 2 Junior Poster in Training

Maybe not the best forum to post this, but anyway;
The problem is that I have a DB table that has a composite PK.This composite key is built up from an id, and a foreign key which is another id in another table. I have the mappings for these tables, they look like this:

@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private int id;
@Id
	@Column(name="song_id")
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private int songId;
	@Id
	@Column(name="artist_id")
	private int artistId;

How can I tell my app. that artistId should be the same as id from the other class?

Thanks,
-Chaster

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.