开发者

Convention for naming domain objects in Hibernate via regular sql

开发者 https://www.devze.com 2023-03-16 01:16 出处:网络
In a project I am working on, we have the convention that Hibernate objects (those that are mapped in *.hbm.xml files) end with the suffix \"Hib\". For exmaple, we\'ll have \"UserHib\", and \"OrderHib

In a project I am working on, we have the convention that Hibernate objects (those that are mapped in *.hbm.xml files) end with the suffix "Hib". For exmaple, we'll have "UserHib", and "OrderHib", etc.

The reason we find it useful is that wh开发者_如何转开发en looking at code residing outside of the dao layer, it makes it very intuitive to know that these objects are domain objects. It also flags for potential issues (e.g., lazy initialization, proxy objects).

Now I need to add some domain objects that will be accessed and created via regular jdbc layer, and I am wondering what would be a useful suffix, if any at all? Would using the same suffix increase confusion (new objects not found in .hbm.xml files) or reduces confusion (uniform suffix for domain objects)?

Any thoughts?


If your projects states, that you have to use a naming convention only for hibernate objects, then it is fine, go ahead and use a seperate naming convention, untill and unless you are not adding that into the hibernate mapping file.

And after adding this, make sure that you roll information to everyone out there in your team that you are adding one more naming convention, for pure JDBC objects, that will help to get some other ideas from your seniors (if any), and if someone else wants to add a JDBC Object, then it follows the same naming convention.

0

精彩评论

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