简体   繁体   English

使用休眠工具进行代码生成时,在表名中处理“ $”

[英]Handling '$' in Table name when using hibernate tools to do code generation

I am using Hibernate tools (eclipse plugin) to do code generation to create the POJO & th hbm, But table name that contain '$' will make problem. 我正在使用Hibernate工具(eclipse插件)进行代码生成以创建POJO和hbm,但是包含“ $”的表名会出现问题。 eg, for table 'Buyer$Souce' will generate a class named 'Buyer.souce' 例如,对于表“ Buyer $ Souce”,将生成一个名为“ Buyer.souce”的类
is there any way to solve this problem? 有什么办法解决这个问题? I want to just ignore the '$' ,eg, 'Buyer$source' generate 'BuyerSouce.java' 我只想忽略'$',例如'Buyer $ source'生成'BuyerSouce.java'

Thanks 谢谢

I don't think there is a directly with the Hibernate Tools Plugin. 我认为Hibernate Tools插件不直接提供。 You could generate everything except Buyer$Source and manually code the class for BuyerSource. 您可以生成除Buyer $ Source以外的所有内容,并手动为BuyerSource编写该类的代码。 Use an annotation (or modify the hbm) to set the table name. 使用注释(或修改hbm)设置表名。

@Entity
@Table(name="Buyer$Souce")
public class BuyerSouce  {
//...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM