Spring data jpa 时间注解
SegmentFault
共 1216字,需浏览 3分钟
·
2020-08-23 18:27
先定义一个构造函数:
function Person(name,age){
this.name = name;
this.age = age;
this.say = function(){
console.log("hello world")
}
}
Person.prototype.gender = male;
1.原型链继承:将子类的构造函数的原型变为父类的实例对象
Student.prototype = new Person();
Student.prototype.constructor = Student
优点:实现简单
缺点:无法向父构造函数传参
2.通过构造函数继承
function Student(name,age){
Person.call(this,name,age)
this.name = name;
this.age = age;
this.say = function(){
console.log("hello world")
}
}
缺点:无法访问父构造函数的原型中的方法
3.将子构造函数的原型修改为父构造函数的原型
function Student(name,age){
Person.call(this,name,age)
this.name = name;
this.age = age;
this.say = function(){
console.log("hello world")
}
}
Student.prototype = Person.prototype
Student.prototype.constructor = Student
缺点:破坏了原型链,给子类的原型添加属性父类原型也会添加
4.将子类的原型设置为父类的实例对象
function Student(name,age){
Person.call(this,name,age)
this.name = name;
this.age = age;
this.say = function(){
console.log("hello world")
}
}
Student.prototype = new Person();
缺点:调用了两次父类构造函数,消耗内存
评论
Spring Data JPA轻松实现基于 JPA 的库
Spring Data JPA 的目标是通过让一些必须的工作变得更简单,来显著提高数据访问层的实现。
Spring Data JPA轻松实现基于 JPA 的库
0
Spring Data JPA轻松实现基于 JPA 的库
SpringDataJPA的目标是通过让一些必须的工作变得更简单,来显著提高数据访问层的实现。作为一个开发者,你写你的仓库界面,包括自定义查询方法,而Spring给你提供自动实现。特性对建立基于Spr
Spring Data JPA轻松实现基于 JPA 的库
0
jpa-specSpring Data 的 JPA 查询
jpa-spec 在Spring Data JPA之上做扩展,支持原生JPA2规范,极大的简化动态查
jpa-specSpring Data 的 JPA 查询
0