简体   繁体   English

如何在grails中使用现有的Java数据绑定?

[英]How to use existing java data bindings in grails?

I need to add a new datasource to my grails project wich uses the musicbrainz postgresql database. 我需要为我的grails项目添加一个新的数据源,它使用musicbrainz postgresql数据库。 http://musicbrainz.org/doc/MusicBrainz_Database http://musicbrainz.org/doc/MusicBrainz_Database

I found a project on github where the data bindings are ready to use for a spring project: https://github.com/lastfm/musicbrainz-data 我在github上找到了一个项目,数据绑定可以用于一个spring项目: https//github.com/lastfm/musicbrainz-data

Am i able to use these data bindings in a grails 2.2.3 project? 我能在grails 2.2.3项目中使用这些数据绑定吗? If yes, how can i do this? 如果是的话,我该怎么做? (because there is no hibernate xml as needed by grails (regarding to the grails documentation: Hibernate Mapped Domain Classes)) (因为grails需要没有hibernate xml(关于grails文档:Hibernate Mapped Domain Classes))

I don't think it will be. 我认为不会。 Just setup the additional datasource and model out the tables or objects you need. 只需设置其他数据源并建模您需要的表或对象。

How do you access two databases in Grails 如何在Grails中访问两个数据库

Once you do that, you can use all of the GORM methods and dynamic finders to get your data. 完成后,您可以使用所有GORM方法和动态查找器来获取数据。 Plus validation criteria, transactions, etc. Unless there is some very specialized criteria that make it necessary to bypass GORM, I would suggest leveraging it. 加上验证标准,交易等。除非有一些非常专业的标准使得必须绕过GORM,我建议利用它。

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

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