Hyperjaxb的作者在这里。
HJ3 尝试生成尽可能跨数据库兼容的注释。30 个字符的截断来自 Oracle。
目前,它在默认命名策略中是“硬编码”的。没有办法“轻松”重新配置它(即通过插件配置选项或类似的)。唯一的选择似乎是编写自己的命名策略或记录默认命名策略。这是一个演示如何执行此操作的测试项目:
https://github.com/highsource/hyperjaxb3/tree/master/ejb/tests/custom-naming
我认为您基本上只需要使用该org/jvnet/hyperjaxb3/ejb/plugin/custom/applicationContext.xml
文件创建一个“扩展”JAR:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean name="naming" class="org.jvnet.hyperjaxb3.ejb.strategy.naming.impl.DefaultNaming">
<property name="reservedNames" ref="reservedNames"/>
<property name="ignoring" ref="ignoring"/>
<property name="maxIdentifierLength" value="128"/>
</bean>
</beans>
然后将此工件添加到 HJ3 插件的类路径中。例如,在 Maven 中:
<build>
<defaultGoal>test</defaultGoal>
<plugins>
<plugin>
<groupId>org.jvnet.hyperjaxb3</groupId>
<artifactId>maven-hyperjaxb3-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.jvnet.hyperjaxb3</groupId>
<artifactId>hyperjaxb3-ejb-tests-custom-naming-extension</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
这将覆盖默认命名配置。