如何全局配置Dali Java Persistence Tools的数据库-Java类型映射规则以适配300+数据库表?
How to Configure Global Type Mappings in Dali Java Persistence Tools
Absolutely! You don’t have to waste time adjusting each of your 300+ tables one by one—Dali Java Persistence Tools fully supports global type mapping configuration that applies to all tables by default. Here’s how to set it up step by step:
1. Access Dali’s Global Preferences
- Open Eclipse (since Dali is an Eclipse-based tool) and navigate to
Window > Preferences(Windows/Linux) orEclipse > Settings(macOS). - In the preferences tree, expand JPA > Data Management > Type Mapping. This is where you’ll manage all global database-to-Java type mappings.
2. Update the Default Type Mappings
In the Type Mapping page, you’ll see a table listing database types and their corresponding default Java types. Adjust the entries you need:
- Locate the
XMLdatabase type and change its mapped Java type fromObjecttoString. - Find the
INTEGERdatabase type and switch its Java type frominttoInteger. - For the
TIMESTAMPdatabase type, update the mapped Java type tojava.sql.Date(stick with your confirmed correct mapping here, though note that newer Java projects might preferjava.time.LocalDateTime—use what works for your Spring setup). - Click Apply and Close to save these global rules.
3. Regenerate Your Entity Classes
- Now, when you run Dali’s entity generation wizard again for your 300+ tables, it will automatically apply your custom global mappings instead of the defaults.
- If you’ve already generated entities, you can re-run the wizard, select all tables, and Dali will overwrite the existing classes with the corrected types. Just make sure to back up your work first as a precaution!
Additional Tips
- If you ever need exceptions to the global rule for specific tables, Dali still allows per-table overrides—but your global settings will be the default for all tables.
- Ensure your Eclipse and Dali plugin are up to date. Older versions might have limited global mapping functionality, so updating can avoid unexpected issues.
内容的提问来源于stack exchange,提问作者driftingprogrammer
相关产品推荐
相关产品推荐

