Reputation: 409
I would like to declare in the persistence.xml file that every String type would be mapped to text type. I want to declare the charset type too.
I woudn't like to declare this mapping by every single attribute with the @Column...
Upvotes: 1
Views: 379
Reputation: 1912
There is no such 'default' configurations for datatypes. You would need to do set one by one.
If you want to do it in the persistence.xml you need to add a code like:
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>
Create a file with a code like the code below:
<?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>
Upvotes: 3