为我已经设置了Hibernate的数据库实现RESTful接口 [英] Implementing a RESTful interface for db that I have set up Hibernate for

查看:97
本文介绍了为我已经设置了Hibernate的数据库实现RESTful接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个实现了Hibernate集成的数据库.我想知道最好使用什么库向其添加RESTful接口?

I have a database that I have implemented Hibernate integration with. I was wondering what is the best library to use to add a RESTful interface to it?

我的计划是让用户提交其登录信息.他们登录到该服务器后,我可以应答来自他们的REST调用.我将需要能够通过他们的用户权限来过滤他们的请求的功能. (换句话说,查看他们的登录特权,并过滤掉他们不应该看到的数据,并禁止他们更改不应被允许更改的数据.)

My plan is to have the user submit their login information. After they are logged into this server I can answer REST calls from them. I will need the ability filter their requests by their user privileges. (In other words, look at their login privileges, and filter out data they shouldn't see and disallow them from changing data they should not be allowed to change).

我认为这是一个可以从现有代码库中删除一些代码的新项目.因此它可以是独立服务器.我很乐意使用很多新颖而令人兴奋的技术.

I figure this can new project that simply takes some code out of my existing codebase. So it can be a standalone server. I am very open to using a lot of new and exciting technologies.

有什么建议吗?

我猜想RestEasy,Hibernate和JBoss服务器都可以很好地协同工作,因为它们都是Jboss产品.这是正确的吗?或者有更简便/更好的方法吗?

I would guess RestEasy, Hibernate, and JBoss server all work well together because they are all Jboss products. Is this correct or is there an easier/better way to do it?

推荐答案

在JPA和Hibernate之间有一些很好的比较:此处.

Here a couple of good comparisons between JPA and Hibernate: here and here.

无论如何,我正在将JPA用于一种简单的方法,如您所描述的那样.有关如何使用NetBeans向导从数据库创建RESTful Web服务的信息,请参见此处. 和此处,以获取有关如何根据登录用户给出不同结果的答案.

Anyway I am using JPA for a simple approach like the one you have described. See here for how to create RESTful web services from db using NetBeans's wizard. and here for an answer on how to give different results depending on the user logged.

NetBeans的教程适用于任何符合Java EE 6规范的Web容器,因为它使用JAX-RS库.

The tutorial from NetBeans applies to any web container compliant with Java EE 6 specifications, because it uses JAX-RS library.

这篇关于为我已经设置了Hibernate的数据库实现RESTful接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆