1
我想在persistence.xml文件中声明每个String类型都将映射到文本类型。 我想声明字符集类型。我可以在persistence.xml中声明映射吗?
我woudn't喜欢通过与@Column每一个属性来声明这个映射...
我想在persistence.xml文件中声明每个String类型都将映射到文本类型。 我想声明字符集类型。我可以在persistence.xml中声明映射吗?
我woudn't喜欢通过与@Column每一个属性来声明这个映射...
没有为数据类型没有这样的“默认”的配置。你需要做一个一个的设置。
如果你想这样做在persistence.xml你需要添加类似代码:
YOUR_PROVIDER
<!--
create a file that will have the mapping,
in this case the file name is orm.xml
-->
<mapping-file>orm.xml</mapping-file>
<properties>
<!--YOUR PROPERTIES-->
</properties>
中包含的代码的代码创建一个文件:
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/persistence/orm"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
version="1.0">
<entity class="com.uaihebert.model.test.Manufacturer">
<attributes>
<basic name="name">
<!--Here you will declare your type-->
<column />
</basic>
</attributes>
</entity>
</entity-mappings>