用hibernate查询sql数据库并输出
相关数据表:packagecom.scilab.pojo;importjava.util.Date;importjavax.persistence.Column;impo...
相关数据表:
package com.scilab.pojo;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
@Entity
@Table(name="tbl_function")
public class FunctionInfo {
private Long funId;
private Long userId;
private String funName;
private String funContent;
private String funHelp;
private String funExample;
private Date saveTime;
/**
* 0 未发布,1已发布
*/
private int funStatue;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="funId", nullable=false)
public Long getFunId() {
return funId;
}
public void setFunId(Long funId) {
this.funId = funId;
}
@Column(nullable=false)
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
@Column(length=100,nullable=false)
public String getFunName() {
return funName;
}
public void setFunName(String funName) {
this.funName = funName;
}
@Lob
@Column(nullable=false, columnDefinition="blob")
public String getFunContent() {
return funContent;
}
public void setFunContent(String funContent) {
this.funContent = funContent;
}
@Lob
@Column(nullable=false, columnDefinition="blob")
public String getFunHelp() {
return funHelp;
}
public void setFunHelp(String funHelp) {
this.funHelp = funHelp;
}
@Lob
@Column(nullable=false, columnDefinition="blob")
public String getFunExample() {
return funExample;
}
public void setFunExample(String funExample) {
this.funExample = funExample;
}
@Column(nullable=false)
public Date getSaveTime() {
return saveTime;
}
public void setSaveTime(Date saveTime) {
this.saveTime = saveTime;
}
@Column(nullable=false)
public int getFunStatue() {
return funStatue;
}
public void setFunStatue(int funStatue) {
this.funStatue = funStatue;
}
}
请问如何从其中查询某个用户(比如userId = 3)的编写的所有函数名funId.
高手赐教,多谢,解决问题可以加分。 展开
package com.scilab.pojo;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
@Entity
@Table(name="tbl_function")
public class FunctionInfo {
private Long funId;
private Long userId;
private String funName;
private String funContent;
private String funHelp;
private String funExample;
private Date saveTime;
/**
* 0 未发布,1已发布
*/
private int funStatue;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="funId", nullable=false)
public Long getFunId() {
return funId;
}
public void setFunId(Long funId) {
this.funId = funId;
}
@Column(nullable=false)
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
@Column(length=100,nullable=false)
public String getFunName() {
return funName;
}
public void setFunName(String funName) {
this.funName = funName;
}
@Lob
@Column(nullable=false, columnDefinition="blob")
public String getFunContent() {
return funContent;
}
public void setFunContent(String funContent) {
this.funContent = funContent;
}
@Lob
@Column(nullable=false, columnDefinition="blob")
public String getFunHelp() {
return funHelp;
}
public void setFunHelp(String funHelp) {
this.funHelp = funHelp;
}
@Lob
@Column(nullable=false, columnDefinition="blob")
public String getFunExample() {
return funExample;
}
public void setFunExample(String funExample) {
this.funExample = funExample;
}
@Column(nullable=false)
public Date getSaveTime() {
return saveTime;
}
public void setSaveTime(Date saveTime) {
this.saveTime = saveTime;
}
@Column(nullable=false)
public int getFunStatue() {
return funStatue;
}
public void setFunStatue(int funStatue) {
this.funStatue = funStatue;
}
}
请问如何从其中查询某个用户(比如userId = 3)的编写的所有函数名funId.
高手赐教,多谢,解决问题可以加分。 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询