在JPA上映射Oracle XMLType(EclipseLink) [英] Mapping Oracle XMLType on JPA (EclipseLink)

查看:209
本文介绍了在JPA上映射Oracle XMLType(EclipseLink)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个有一些特殊要求的项目,其中一项是从Oracle 10g数据库的XMLType数据库列中获取数据。

We have a project with some special requirements, one of wich is getting data from a XMLType database column from an Oracle 10g database.

我们找到了一个简单的解决方案使用JDBC,但它会驱动应用程序有点混乱,因为所有数据访问都是通过JPA完成的(使用的实现是EclipseLink)。

We have found an easy solution using JDBC, but it would drive the application a little messy, as all the data access is being done through JPA (the implementation used is EclipseLink).

我们做了一些研究,并找到了一些解决方案,如使用转换器和其他辅助类型,但实现似乎有点复杂。

We have done some research, and have found some solutions, as using Converters and other auxiliar types, but the implementations seemed a little complicated.

所以,我的问题是:

您能否建议我使用JPA将XMLType数据列映射到Java对象类型的简单方法?

So, my question is:
Could you recommend me an easy way to map an XMLType data column to a Java Object type, using JPA?

提前致谢。

推荐答案

您是否尝试将其映射为字符串?

Did you try just mapping it as a String?

在EclipseLink中,您还可以映射它使用DescriptorCustomizer进行DirectToXMLTypeMapping(尚未支持注释),或者像你一样使用Converter。

In EclipseLink you can also map it using a DirectToXMLTypeMapping using a DescriptorCustomizer (no annotation support yet), or using the Converter as you have done.

这篇关于在JPA上映射Oracle XMLType(EclipseLink)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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