@Entity
@Table(name="tb_label")
public class Label implements Serializable {
@Id
private String id;//
private String labelname;//标签名称
private String state;//状态
private Long count;//使用数量
private Long fans;//关注数
private String recommend;//是否推荐
public Label() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLabelname() {
return labelname;
}
public void setLabelname(String labelname) {
this.labelname = labelname;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public Long getFans() {
return fans;
}
public void setFans(Long fans) {
this.fans = fans;
}
public String getRecommend() {
return recommend;
}
public void setRecommend(String recommend) {
this.recommend = recommend;
}
@Override
public String toString() {
return "Label{" +
"id='" + id + '\'' +
", labelname='" + labelname + '\'' +
", state='" + state + '\'' +
", count=" + count +
", fans=" + fans +
", recommend='" + recommend + '\'' +
'}';
}
}
//dao层代码
public interface LabelDao extends JpaRepository
1.3、@Query注解传递参数查询
//**************************************dao层代码**************************************
public interface LabelDao extends JpaRepository
1.4、@Query注解中Like模糊查询
//***********************************以下是dao代码*********************************************
public interface LabelDao extends JpaRepository {
/**
* @Query注解Like模糊查询1: @Query不写百分号%,但在调用方法时需要使用
*/
@Query("SELECT l from Label l where l.labelname like ?1 or l.state=?2")
List testQueryAnnotationLikeParams1(String labelname,String state);
/**
* @Query注解Like模糊查询2: @Query写百分号%,但在调用方法时不用写
*/
@Query("SELECT l from Label l where l.labelname like %?1% or l.state=?2")
List testQueryAnnotationLikeParams2(String labelname,String state);
/**
* @Query注解Like模糊查询3,使用命名方式结合@Param注解
*/
@Query("SELECT l from Label l where l.labelname like %:labelname% or l.state=:state")
List testQueryAnnotationLikeParams3(@Param("state") String state,@Param("labelname") String name);
}
//***********************************以下是测试代码*********************************************
@RunWith(SpringRunner.class)
@SpringBootTest(classes = BaseApplication.class)
public class JpaTest {
@Autowired
private LabelDao labelDao;
/**
* 使用like模糊查询 @Query中不写百分号%,但在调用方法时需要使用
*/
@Test
public void testQueryAnnotationLikeParams1(){
List list = labelDao.testQueryAnnotationLikeParams1("%java%", "1");
list.stream().forEach(label -> {
System.err.println("*****"+label.toString());
});
}
/**
* 使用like模糊查询 @Query中写百分号%,但在调用方法时不用写
*/
@Test
public void testQueryAnnotationLikeParams2(){
List list = labelDao.testQueryAnnotationLikeParams2("java", "1");
list.stream().forEach(label -> {
System.err.println("*****"+label.toString());
});
}
@Test
public void testQueryAnnotationLikeParams3(){
List list = labelDao.testQueryAnnotationLikeParams3("1", "php");
list.stream().forEach(label -> {
System.err.println("*****"+label.toString());
});
}
}
1.5、@Query注解本地SQL语句查询
//*********************************dao层代码*****************************************
public interface LabelDao extends JpaRepository {
/**
* 原生的sql语句查询
* nativeQuery =true表示启用本地sql语句查询
* @return
*/
@Query(value = "select count(id) from tb_label",nativeQuery =true )
long getCount();
}
//**********************************测试代码**********************************************
@RunWith(SpringRunner.class)
@SpringBootTest(classes = BaseApplication.class)
public class JpaTest {
@Autowired
private LabelDao labelDao;
@Test
public void getCount(){
long count = labelDao.getCount();
System.err.println("------------:"+count);
}
}
最近mysql数据库经常死掉,用命令net stop mysql命令也无法停掉,关闭Tomcat的时候,出现Waiting for N instance(s) to be deallocated 信息。查了下,大概就是程序没有对数据库连接释放,导致Connection泄露了。因为用的是开元集成的平台,内部程序也不可能一下子给改掉的,就验证一下咯。启动Tomcat,用户登录系统,用netstat -
var a=document.getElementsByClassName('textinput');
var b=[];
for(var m=0;m<a.length;m++){
if(a[m].getAttribute('placeholder')!=null)
b.push(a[m])
}
var l
错误信息:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cartService': Scope 'session' is not active for the current thread; consider defining a scoped
这个开源软件包是国内的一位高手自行研制开发的,正如他所说的一样,我觉得它可以使一个工作流引擎上一个台阶。。。。。。欢迎大家使用,并提出意见和建议。。。
----------转帖---------------------------------------------------
IK Expression是一个开源的(OpenSource),可扩展的(Extensible),基于java语言
1.在thingking in java 的第四版第六章中明确的说了,子类对象中封装了父类对象,
2."When you create an object of the derived class, it contains within it a subobject of the base class. This subobject is the sam
http://www.sap.com/corporate-en/press.epx?PressID=14787
有机会研究下EIM家族的两个新产品~~~~
New features of the 4.0 releases of BI and EIM solutions include:
Real-time in-memory computing –
结构
继承关系
public final class Manifest extends Objectjava.lang.Objectandroid.Manifest
内部类
class Manifest.permission权限
class Manifest.permission_group权限组
构造函数
public Manifest () 详细 androi
关键字:Oracle实现类split函数的方
项目里需要保存结构数据,批量传到后他进行保存,为了减小数据量,子集拼装的格式,使用存储过程进行保存。保存的过程中需要对数据解析。但是oracle没有Java中split类似的函数。从网上找了一个,也补全了一下。
CREATE OR REPLACE TYPE t_split_100 IS TABLE OF VARCHAR2(100);
cr