[英]Override grails GORM methods (save, update delete)
My Line Manager insists I use a REST based call to implement my persistence layer(which uses stored procedures) which I have done because he has a belief that hibernates doesn't scale well for performance(which I debated with him to no avail). 我的Line Manager坚持认为我使用了基于REST的调用来实现我的持久层(使用存储过程),这是因为他坚信冬眠不能很好地扩展性能(我与他争论过这没有用)。 I now want to override grails GORM methods(save, update, delete....) or better still, implement a REST data source.
我现在想覆盖grails GORM方法(保存,更新,删除...)或更好的方法,实现REST数据源。 Anyone with any idea?
有任何想法吗? Thanks
谢谢
GORM objects can be exposed as REST resources, by simply annotating as defined here: 只需按以下定义进行注释,即可将GORM对象公开为REST资源:
http://grails.github.io/grails-doc/latest/guide/webServices.html#domainResources http://grails.github.io/grails-doc/latest/guide/webServices.html#domainResources
But in your case, I would suggest you call stored procedures within service classes. 但就您而言,我建议您在服务类中调用存储过程。 You can get reference to the database connection, by injecting a dataSource.
您可以通过注入dataSource获得对数据库连接的引用。
You can then call these service methods, in a controller, which can extend a RESTController. 然后,您可以在可以扩展RESTController的控制器中调用这些服务方法。 Please refer to the following link .
请参考以下链接 。
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.