开发者

Is it necessary to keep relationships in DB to map pojos as one-2-one or one-2-many mappings

I have a doubt, suppose i have 2 pojos, lets assume i want to have one-2-one or one-2-many relationship between them. is it necessary to define 开发者_StackOverflow中文版the foreign key reference in the DB, or defining in the hibernate or JPA is enough.


In my experience, yes, it's possible, and works well. But it would break consistency and may cause future problems (e.g. if you make changes to the tables and/or pojos). (Tested with MS SQL Server 2005, and MySQL).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜