生成代码时如何利用JPA?

技术标签: JPA.  XSD.  坚持

我有来自XML模式生成的客户,内科,ExtendCustomer(具有适当继承)等实体的课程。我想使用JPA(如果相关的话,建议您的答案中的具体实施),以持续来自这些类的对象,但由于生成它们并且当我更改架构并重新生成时,我无法擦除注释。这可以在不使用注释否则vietistence.xml文件的情况下完成吗?

还有一个工具,我可以将类(或架构)提供为输入,并让我给我SQL语句以创建DB(甚至为我创建它?)。似乎是因为我有一个模式,它需要在创建数据库时所需的所有信息应该在那里。我不是在谈论创建索引,或任何调整DB,但只是创建正确的表等。

提前致谢

看答案

您可以在这种情况下肯定使用JDO,动态生成类,元数据,任何字节代码增强,然后是运行时持久性,利用类加载器在其中生成和增强的类。按照 http://www.jpox.org/servlet/wiki/pages/viewpage.action?pageid=66191888

JPA不幸的是没有这样的元数据API。

- andy(数据核盒)


智能推荐

MyBatis代码自动生成(利用eclipse插件)

上一篇文章已经介绍了利用命令的方式自动生成mybatis代码,但是每次都去运行cmd命令感觉还是有点麻烦,所以找了些资料发现eclipse里面也可以安装插件自动生成代码,下面简单介绍一下,也是给自己以后使用时留一个存档。 首先还是下载工具:http://download.csdn.net/detail/u010608551/9490134 下载完之后会得到一个jar文件,然后将这个文件拷贝到ecl...

MyBatis代码自动生成(利用命令)

这几天在学习springmvc,需要用到mybatis,所以研究了一下mybatis自动代码生成,当然也可以手动敲,但是那样效率非常的慢,并且出错率也是很高的,利用MyBatis生成器自动生成实体类、DAO接口和Mapping映射文件。这样可以大大节约开发时间,将生成的代码copy到项目工程中即可。 要想实现代码的自动生成,首先要下载一个工具:http://download.csdn.net/de...

利用mybatis-generator自动生成代码

原文https://www.cnblogs.com/yjmyzz/p/4210554.html mybatis-generator有三种用法:命令行、eclipse插件、maven插件。个人觉得maven插件最方便,可以在eclipse/intellij idea等ide上可以通用。 下面是从官网上的截图:(不过官网www.mybatis.org 最近一段时间,好象已经挂了) 一、在po...

利用mybatis-generator自动生成代码

带界面版的mybatis geneator,https://github.com/astarring/mybatis-generator-gui 不过要求jdk1.8 mybatis-generator有三种用法:命令行、eclipse插件、maven插件。个人觉得maven插件最方便,可以在eclipse/intellij idea等ide上可以通用。 下面是从官网上的截图:(不过官网www.m...

利用mybatis-generator自动生成代码

mybatis-generator有三种用法:命令行、eclipse插件、maven插件。个人觉得maven插件最方便,可以在eclipse/intellij idea等ide上可以通用。 下面是从官网上的截图:(不过官网www.mybatis.org 最近一段时间,好象已经挂了) 一、在pom.xml中添加plugin  View Code 其中generatorConfig...

猜你喜欢

利用mybatis-generator自动生成代码

1.生成代码需要的文件和jar包: 文件下载地址:点击打开链接 2.需要修改的文件:generatorConfig.xml 3.执行的命令: 进入lib目录  打开黑窗口,执行 Java -jar mybatis-generator-core-1.3.2.jar -configfile generatorConfig.xml -overwrite 在src文件下就会生成我们需要的代码。...

利用mybatis-generator自动生成代码

mybatis-generator有三种用法:命令行、eclipse插件、maven插件。个人觉得maven插件最方便,可以在eclipse/intellij idea等ide上可以通用。 下面是从官网上的截图:(不过官网www.mybatis.org 最近一段时间,好象已经挂了) 一、在pom.xml中添加plugin  View Code 其中generatorConfig...

【华为云技术分享】HDC.Cloud | 为防止交通事故,95后学生运用“黑科技”这样做!

【摘要】 智能车伙伴基于AIoT,利用实时抓取到的图像信息融合实时监测的体征数据,综合判断驾驶员疲劳程度和状态,并发出提醒,最终完成“基于AIoT的驾驶员状态实时监测系统 经常在电视上总会看到这样的消息:xxx道路发生严重交通事故,X死X伤。 疲劳驾驶和酒驾目前已经成为高速上的头号杀手,根据相关数据统计: ▸每年由酒后驾车引发的交通事故达数万起;而造成死亡的事故中50%以上都与酒后驾车...

网络与多媒体基础知识--软考

前言: 最近小编在准备软件中级设计师的考试时学到了网络和多媒体基础知识,今天和大家来学习下。先上一张导图。 基本概念: 计算机网络:多台计算机组成的系统,他实现了远程通信, 远程信息处理,资源共享   媒体:1.信息的物理载体(存储,传递信息的实体)如手册,磁盘,光盘,磁带及相关播放设备等:2.承载信息的载体:即信息的表现形式(或传播形式),如文字,声音,图像,动画和视频等,即...

阿里云的免费云虚拟主机

最近刚刚把我的网站移到了阿里云,感谢阿里提供的免费云虚拟主机。 免费主机就一个要求,要绑定备案的域名,自己可以自由选择Windows/Linux系统,选好不能更换。 空间:1G,支持ASP/PHP和数据库。 申请页面:http://www.net.cn/hosting/free...

问答精选

knitr: keep cache when I make small change in chunk

I understandably broke cache when updating a chunk (however the result should be the same, it was cosmetic changes). However, I do not want to run the chunk again because it takes 1 week to run. How c...

Parsing reddit json into Python array and print items from array

This is my first couple of weeks coding; apologies for a basic question. I've managed to parse the 'WorldNews' subreddit json, identify the individual children (24 of them as I write) and grab the tit...

How would I make it so that a border only spans a certain length, on one side?

How would I make it so that a border only spans a certain length, on one side? I tried and the css: You can try the line-height hack: The pseudo-element hack:...

Modalize does not override react navigation

Each time the user taps on a specific element I want to appear a modalize that describes everything of what the user tapped, I am using Modalize and tried to use portalize but I can't make the modaliz...

Duplicate code from identical objects in separate namespaces

I am writing a console app to make managing a local SSRS instance easier using the ReportExecution2005 and ReportService2010 libraries each providing different functions. To work with existing reports...

相关问题

相关文章

热门文章

推荐文章

相关标签

推荐问答