netbeans 6.5.1 反向引擎 Oracle 实体

发布于 2024-08-10 11:03:35 字数 161 浏览 6 评论 0原文

我是反向引擎实体类,但主键没有用 GenelatedValue 注释。我的表是在oracle上创建的。我是否需要在表主键上添加自动增量约束?

现在我手动编辑实体并添加 generatedValue 。寻找更好的解决方案。我认为当反向引擎时,它应该生成那些注释

i reverse engined entity class but the primary key is not anottaed with GeneratedValue . my table is created on oracle. do i need to add contraint on the table primary key for auto increment?

rightn ow i manually edit the entity and add generatedValue . looking for better solution . i think when reverse engine, it suppose to generate those anotation

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

飘落散花 2024-08-17 11:03:36

Netbeans 实际上在从已有的数据库结构快速生成实体类的骨架结构方面做得非常好。话虽如此,您必须记住,它仍然足以让您运行,将其视为生产级代码是愚蠢的。您将必须进一步完善它。

在 Java 中,我通常发现自己正在做的是使用各种工具仔细构建我的数据模型(我会尽量避免在这里进行推销)。一旦我觉得它相当充实,我将生成 DDL,建立数据库,然后使用工具对其进行逆向工程。但我总是通过检查代码并根据需要进行更正来跟进。从那时起,我通常首先对我的实体进行更改,然后手动将等效的更改传播到数据库。

我已经有一段时间没有进行任何认真的 Java/DB 开发了,只是因为我正在从事的大型项目有一个专门的 DB 团队,所以现在可能有一些很好的工具,可以非常准确地生成 DDL 和实体,并且同步。然而,即使是这样,对于任何中小型项目,我仍然可能会遵循上述做法。

Netbeans actually does a pretty nice job of quickly generating a skeleton structure of your entity classes from an already in-place database structure. With that being said, you have to remember that it's still just enough to get you running and it would be foolish to consider it production-grade code. You will have to further refine it.

In Java what I commonly find myself doing is carefully crafting my data model using any of a variety of tools (I'll try to avoid making a sales pitch here). Once I feel that it's fairly fleshed out, I'll generate the DDL, throw up the database, and then reverse engineer it using a tool. But I always follow that up by going through the code and correcting as necessary. From that point forward I usually make changes to my entities first and then manually propagate the equivalent changes to the database.

It's been a while since I've done any serious Java/DB development simply because the large project I'm working on has a dedicated DB team, so there may be some good tools now that can both generate your DDL and entities very accurately and in sync. However, even if that were the case, I would still probably follow the above practice for any small to medium sized project.

温暖的光 2024-08-17 11:03:36

我从来没有见过一个 JPA 工具可以正确地对 Oracle 数据库进行逆向工程。我总是不得不对逆向工程代码进行许多修改。我通常只进行一次逆向工程,然后将所有新更改从代码传播到数据库。

I have never seen a JPA tool that reverse-engineered an oracle database properly. I've always had to make many modifications to the reverse-enginneered code. I usually just reverse engineer once and after that propagate all new changes from the code to the DB.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文