问题描述
$ b 我使用IDE'hibernate代码生成生成hibernate beans, / p>
2)另外,我已经使用maven编译器生成了jaxb bean。
..
现在,我的问题是,
这是正确的方法吗? (要有这么多的bean)。
我应该使用JAXb beans来处理服务层吗?我如何保持图层的分离?
3)或者,是否需要创建另一组bean,即。将(新的bean)映射(jaxb beans)到(hibernate beans)?
。
请告诉你如果您有任何疑问,请联系我们,我们会尽快为您解答。
知道,你不能让一切都完全分离。总会有一层会知道其他两层。通常当我设计3层架构时,比如:
- 服务层 - 可能使用JAXB的服务层,公开Web服务或其他API
- 业务层 - 任何实际逻辑
- 持久层 - hibernate
我允许业务层了解服务层(JAXB)和持久性图层(休眠豆)。但是我不允许服务层和持久层相互了解。
Currently I am working on a project with Spring web-service, hibernate and JAXb.
1) I have generated hibernate beans using IDE 'hibernate code generation,
2) also, I have generated the jaxb beans using maven compiler.
..
Now, my question is,
1) Is this the right approach? (to have so many beans).
2) Shall I use JAXb beans for processing into the service layer? How can I keep layers decoupled?
3) Or, do I need to create another set of beans ie. map (JAXb beans) to (new beans) to (hibernate beans)?
.
Please tell your views?
Thanks,adi
You know, you cannot have everything fully decoupled. There will be always a layer that will know the other two layers.
Usually when I design 3 layers architecture, like:
- Service Layer - the one that probably uses JAXB, exposes web services or other APIs
- Business Layer - any real logic
- Persistence Layer - hibernate
I allow the Business layer to know about the Service Layer (JAXB) and about the Persistence Layer (hibernate beans). But I don't allow the Service Layer and the Persistence Layer to know about each other.
这篇关于JAXb,Hibernate和beans的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!