I am making an application now, and I started by creating a DB schema that looks like this:

There are several tables (users_groups_maps, articles_tags_maps reports_articles, favorite_articles and browse_later_articles), which are a multiple exemption from many. I created the reverse configuration file and started the reverse engineer so that I can extract Java classes from it (annotations, JDK 5 and EJB3, which leads to javax.persistence. * Comments).
Basic tables (e.g. alerts, users) are very good (there are fields like
private Set<BrowseLaterArticles> browseLaterArticleses = new HashSet<BrowseLaterArticles>(0);
but I think it's just fine - I'm new to sleep mode).
However, the problem (I think) begins with this many-to-many relationship (for example, the UserGroupsMaps constructor looks like this:
public UsersGroupsMaps(UsersGroupsMapsId id, Users users, Groups groups) { this.id = id; this.users = users; this.groups = groups; }
where UserGroupsMapsId is a wrapper for a pair of userId and groupId)
Am I mistaken or should it be encoded differently? I know there is ManyToMany annotation, why is sleep mode not used?
// Besides, I have not related to hibernate issues - in the comments and private_messages, there are fields parent__id, which should be in the same table. I created foreign keys for my own tables, but I'm not sure if this is correct? What should it look like? In this mode, sleep mode generates two fields with the same name: personal comment comments; in the comment class.
Regards, Marcin