浏览 4804 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2006-11-08
映射如下: <id name="categoryId" type="java.lang.Long"> <column name="CATEGORY_ID" precision="8" scale="0" /> <generator class="sequence"> <param name="sequence">USER_CATEGORY_SEQUECNCE</param> </generator> </id> create sequence USER_CATEGORY_SEQUECNCE increment by 1 start with 1 maxvalue 99999999 minvalue 1 nocycle cache 5; POJO类为下面: import java.util.Date; import java.util.HashSet; import java.util.Set; public class UserCategory implements java.io.Serializable { // Fields private Long categoryId; private UserSpace userSpace; private Template template; private UserCategory userCategory; private String categoryName; private String categoryDesc; private Long categoryType; private Date categoryDate; private Long categoryHits; private Long categoryPro; private Long isPublish; private Long categoryDepth; private String visitPwd; private Long resourseSum; private Set videoInfos = new HashSet(0); private Set userDiaries = new HashSet(0); private Set singMusics = new HashSet(0); private Set userCategories = new HashSet(0); private Set albumInfos = new HashSet(0); // Constructors /** default constructor */ public UserCategory() { } /** minimal constructor */ public UserCategory(UserSpace userSpace, String categoryName, String categoryDesc, Date categoryDate) { this.userSpace = userSpace; this.categoryName = categoryName; this.categoryDesc = categoryDesc; this.categoryDate = categoryDate; } /** full constructor */ public UserCategory(UserSpace userSpace, Template template, UserCategory userCategory, String categoryName, String categoryDesc, Long categoryType, Date categoryDate, Long categoryHits, Long categoryPro, Long isPublish, Long categoryDepth, String visitPwd, Long resourseSum, Set videoInfos, Set userDiaries, Set singMusics, Set userCategories, Set albumInfos) { this.userSpace = userSpace; this.template = template; this.userCategory = userCategory; this.categoryName = categoryName; this.categoryDesc = categoryDesc; this.categoryType = categoryType; this.categoryDate = categoryDate; this.categoryHits = categoryHits; this.categoryPro = categoryPro; this.isPublish = isPublish; this.categoryDepth = categoryDepth; this.visitPwd = visitPwd; this.resourseSum = resourseSum; this.videoInfos = videoInfos; this.userDiaries = userDiaries; this.singMusics = singMusics; this.userCategories = userCategories; this.albumInfos = albumInfos; } // Property accessors public Long getCategoryId() { return this.categoryId; } public void setCategoryId(Long categoryId) { this.categoryId = categoryId; } public UserSpace getUserSpace() { return this.userSpace; } public void setUserSpace(UserSpace userSpace) { this.userSpace = userSpace; } public Template getTemplate() { return this.template; } public void setTemplate(Template template) { this.template = template; } public UserCategory getUserCategory() { return this.userCategory; } public void setUserCategory(UserCategory userCategory) { this.userCategory = userCategory; } public String getCategoryName() { return this.categoryName; } public void setCategoryName(String categoryName) { this.categoryName = categoryName; } public String getCategoryDesc() { return this.categoryDesc; } public void setCategoryDesc(String categoryDesc) { this.categoryDesc = categoryDesc; } public Long getCategoryType() { return this.categoryType; } public void setCategoryType(Long categoryType) { this.categoryType = categoryType; } public Date getCategoryDate() { return this.categoryDate; } public void setCategoryDate(Date categoryDate) { this.categoryDate = categoryDate; } public Long getCategoryHits() { return this.categoryHits; } public void setCategoryHits(Long categoryHits) { this.categoryHits = categoryHits; } public Long getCategoryPro() { return this.categoryPro; } public void setCategoryPro(Long categoryPro) { this.categoryPro = categoryPro; } public Long getIsPublish() { return this.isPublish; } public void setIsPublish(Long isPublish) { this.isPublish = isPublish; } public Long getCategoryDepth() { return this.categoryDepth; } public void setCategoryDepth(Long categoryDepth) { this.categoryDepth = categoryDepth; } public String getVisitPwd() { return this.visitPwd; } public void setVisitPwd(String visitPwd) { this.visitPwd = visitPwd; } public Long getResourseSum() { return this.resourseSum; } public void setResourseSum(Long resourseSum) { this.resourseSum = resourseSum; } public Set getVideoInfos() { return this.videoInfos; } public void setVideoInfos(Set videoInfos) { this.videoInfos = videoInfos; } public Set getUserDiaries() { return this.userDiaries; } public void setUserDiaries(Set userDiaries) { this.userDiaries = userDiaries; } public Set getSingMusics() { return this.singMusics; } public void setSingMusics(Set singMusics) { this.singMusics = singMusics; } public Set getUserCategories() { return this.userCategories; } public void setUserCategories(Set userCategories) { this.userCategories = userCategories; } public Set getAlbumInfos() { return this.albumInfos; } public void setAlbumInfos(Set albumInfos) { this.albumInfos = albumInfos; } } 插入到数据库,这个CATEGORY_ID值变成:1.23E50 这样,我通过NAME查找获得这个ID却又变成: 0 请问这问题出现在那? 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2006-11-08
没碰到过这种问题,把你的插入方法贴上来看看!
|
|
返回顶楼 | |
发表时间:2006-11-08
遇到过一次类似现象,原因是一个相邻的date类型的映射写错了。好像是把date(数据库字段类型)映射成个timestamp。
|
|
返回顶楼 | |
发表时间:2006-11-08
1数据库工具有时会把一个字段变成科学计数法
2用javascript时必须转成string再传给javascript可以减少自动转形 |
|
返回顶楼 | |
发表时间:2006-11-08
抛出异常的爱 写道 1数据库工具有时会把一个字段变成科学计数法
他的sequence的最大值是99999999,字段类型又是number(8), 正常情况下怎么会产生1.23E50这样的数字?这肯定不是工具显示方面的问题。
2用javascript时必须转成string再传给javascript可以减少自动转形 |
|
返回顶楼 | |
发表时间:2006-11-09
这种问题难道没人遇到过?
|
|
返回顶楼 | |
发表时间:2006-11-10
你的1.23E50 是在哪里看到的?数据库中?不会吧
|
|
返回顶楼 | |