Java Socket、Hibernate独立使用
大家讲道理
大家讲道理 2017-04-17 13:40:16
0
2
343

有一个需求,需要用Java从Socekt写一个TCP服务供客户端使用,得保证长时间可靠运行,这类型的开发一般是做成什么形式的,写一个可以执行的jar,然后java -jar xx.jar吗?
还有,需要在上面用到数据库,计划用一个现成的ORM框架(比如Hibernate)来免去写sql的麻烦,在这样抛开容器独立运行的情况下Hibernate需要怎么配置,或者有其它相关的ORM框架推荐么?
谢谢!

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(2)
小葫芦

A:
1) If a graphical interface is required, the client can implement it through java/swing
2) The TCP server is packaged into system Services through Apache Daemon to provide services for clients to call
3) Hibernate+Spring method, loading the Hibernate framework through Spring
Resource resource = new FileSystemResource("E:projapplicationContext.xml");
XmlBeanFactory bean = new XmlBeanFactory(resource);
Configure Hibernate related parameters in applicationContext.xml
Or load Hibernate configuration directly

B:
1) Change the TCP service you need to implement into web Services. The use of Hibernate is the same as in the web development environment
2) The client accesses and obtains service data through HttpClient

刘奇

There was a similar project before.
The jar method is used,
If it is a product, if you use java socket to write TCP yourself, stability and performance will be a big problem. It is recommended to use mina or java nio
Just use hibernate directly, no web environment is required.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!