- 主题:懂一点点java的皮毛语法,做过一点点django,想了解springboot
django 的 orm 和 hibernate 比较像,使用自制的语法存取数据库。
mybatis 操作的还是 sql 语句。或者在 xml 里面写上 sql 语句,或者在 java 代码里面用 SELECT() 写 sql 语句。你可以把当成 sql 语句生成器,以及查询结果自动解析到 java entity 的一个小工具。因为很多 sql 语句是自己写的,所以换个数据库那是相当艰难。
现在 mybatis 比 hibernate 更加流行,估计是因为 hibernate 的学习门槛稍微高一些。mybatis 只要懂 sql 语句就会用。
java 的 maven 类似于 python 的 pip,项目里面的 pom.xml 相当于 python 的 requirements.txt,同样纪录一个项目的依赖项。
【 在 hothail 的大作中提到: 】
: 顺便: django也写过几周,感觉思路和java+mybatis这些不太一样。开始的时候很别扭。不知道是不是和java+entityModel + hibernate是不是类似。
--
修改:hgoldfish FROM 120.33.11.*
FROM 120.33.11.*
我以前很喜欢用 proxy class. 因为我认为纯 OO 的话,类型本身应该有业务方法,而不是像把 pojo 当作 c 语言那样的结构体,再传给 singleton 的 service 去处理,那不成了 c 语言的结构化编程了么。
举个例子,系统里面有个 User 类型,我喜欢定义:
class User {
@Transaction
void sendMessage(User other) {...}
@Transaction
void buy(Good good) {...}
}
因为 @Transaction 这个注解的存在,spring 得帮我生成 proxy class. 如果 User 有字段,在 proxy class 里面那些字段的内容就是空的。
【 在 oldwatch 的大作中提到: 】
: Spring AOP defaults to using standard JDK dynamic proxies for AOP proxies. This enables any interface (or set of interfaces) to be proxied.
: Spring AOP can also use CGLIB proxies. This is necessary to proxy classes rather than interfaces. By default, CGLIB is used if a business object does not implement an interface. As it is good practice to program to interfaces rather than classes, business
: classes normally implement one or more business interfaces. It is possible to force the use of CGLIB, in those (hopefully rare) cases where you need to advise a method that is not declared on an interface or where you need to pass a proxied object to a m
: ...................
--
修改:hgoldfish FROM 120.33.11.*
FROM 120.33.11.*
不做开发就找个开发的同学去管。
最怕做甲方的半懂不懂,还天天指指点点的。
【 在 cyberdyne 的大作中提到: 】
: 感谢感谢!!
: 几乎都没听说过,但直觉告诉我,这是正路。
: 问题来了,有没有公认的比较好的资料。
: ...................
--
FROM 120.33.11.*