JPA,从实体到数据库模式开始 [英] JPA, Start with entities vs database schema

查看:151
本文介绍了JPA,从实体到数据库模式开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用JPA时哪个更好,尤其是在启动新项目时?
从设计实体开始,然后让JPA生成数据库或
从数据库模式开始,让工具生成实体类?

Which is better when using JPA, especially when starting a new project? Start with designing entities and then let JPA generate the database or Start with the database schema and let tools generate entity classes?

im part of一家小公司。我是软件开发人员和DBA。我完全可以自由地申请和数据库设计

im part of a small company. im both the software developer and DBA. i have complete freedom for the application and db design

我刚开始项目

推荐答案

如果要设计数据库,请从模式开始。如果要编写软件,请从实体开始。 ORM的目的是让你考虑一个对象模型,而不必担心存储它的数据库,所以这种类型的问题实际上通过暗示领域之间的交叉来混淆这个问题。您是软件开发人员还是DBA?这比你使用JPA的事实要多,这将决定你的正确答案。

If you want to design a database, then start with the schema. If you want to write software, then start with the entities. The point of an ORM is to let you think about an object model without having to worry about the database that stores it, so questions of this type actually confuse the issue somewhat by insinuating crossover between the realms. Are you a software developer or a DBA? That, much more than the fact that you're using JPA, is what will determine the correct answer for you.

这篇关于JPA,从实体到数据库模式开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆