0 Replies Latest reply on Jun 13, 2006 2:53 AM by Ritchie Koh

    There is a SERIOUS bug or error.

    Ritchie Koh Newbie

      Dear.

      I've installed the JBoss 4.0.4 GA with EJB3 with installer.
      There is an bug with dealing with @Lob annotation column in the Mysql 4.1.4.

      The column datatype is text in the mysql, so I've use @Lob annotation.
      If the column data has I18N character(Korean for me), the column datas are cutting it off.
      BUT if the column data has only english character, it's OK.

      - JBoss 4.0.4 GA with EJB 3.0
      - Mysql 4.1.4, database's character set is euckr

      The entity bean source is as below.

      package com.javamodeling.homepage.board;
      
      import java.util.Collection;
      import java.util.Iterator;
      
      import javax.ejb.Remove;
      import javax.persistence.CascadeType;
      import javax.persistence.Column;
      import javax.persistence.Entity;
      import javax.persistence.FetchType;
      import javax.persistence.GeneratedValue;
      import javax.persistence.GenerationType;
      import javax.persistence.Id;
      import javax.persistence.JoinColumn;
      import javax.persistence.Lob;
      import javax.persistence.ManyToOne;
      import javax.persistence.OneToMany;
      import javax.persistence.Table;
      import javax.persistence.TableGenerator;
      
      import org.hibernate.LazyInitializationException;
      
      import com.javamodeling.homepage.common.AbstractResultValue;
      import com.javamodeling.homepage.ejb.JmcMember;
      import com.javamodeling.util.DateUtils;
      
      @Entity
      @Table(name = "JAVAMODELING_BOARD")
      @TableGenerator(name = "IdGen",
       table = "ID_GENERATOR",
       pkColumnName = "ID_NO",
       pkColumnValue = "1",
       valueColumnName = "NEXT_VALUE",
       allocationSize = 1)
      public class Board extends AbstractResultValue {
      
       private Integer boardSeq;
       private Character noticeYn;
       private Integer groupNo;
       private Integer groupIndex;
       private Integer levelDepth;
       private String subject;
       private String contents;
       private String referer;
       private Integer viewCount;
       private Integer childReplyCount;
       private Character deleteYn;
       private Integer memberNo;
       private String inputDate;
       private String updateDate;
       private Integer parentBoardSeq;
       private Integer listSeq;
      
       private Board parentBoard;
      
       private BoardList boardList;
      
       // ???? ??? ?? ??
       private JmcMember jmcMember;
      
       private Collection<BoardFile> boardFiles;
      
       private Collection<Board> childBoards;
      
       public Board() {
      
       }
      
       @Override
       public void reset() {
      
       }
      
       @Column(name = "LIST_SEQ")
       public Integer getListSeq() {
       return listSeq;
       }
      
       public void setListSeq(Integer listSeq) {
       this.listSeq = listSeq;
       }
      
       @Column(name = "BOARD_SEQ")
       @Id @GeneratedValue(strategy=GenerationType.TABLE, generator="IdGen")
       public Integer getBoardSeq() {
       return boardSeq;
       }
      
       public void setBoardSeq(Integer boardSeq) {
       this.boardSeq = boardSeq;
       }
      
       @Column(name = "CHILD_REPLY_COUNT")
       public Integer getChildReplyCount() {
       return childReplyCount;
       }
      
       public void setChildReplyCount(Integer childReplyCount) {
       this.childReplyCount = childReplyCount;
       }
      
       @Column(name = "CONTENTS")
       @Lob
       public String getContents() {
       return contents;
       }
      
       public void setContents(String contents) {
       this.contents = contents;
       }
      
       @Column(name = "DELETE_YN")
       public Character getDeleteYn() {
       return deleteYn;
       }
      
       public void setDeleteYn(Character deleteYn) {
       this.deleteYn = deleteYn;
       }
      
       @Column(name = "GROUP_INDEX")
       public Integer getGroupIndex() {
       return groupIndex;
       }
      
       public void setGroupIndex(Integer groupIndex) {
       this.groupIndex = groupIndex;
       }
      
       @Column(name = "GROUP_NO")
       public Integer getGroupNo() {
       return groupNo;
       }
      
       public void setGroupNo(Integer groupNo) {
       this.groupNo = groupNo;
       }
      
       @Column(name = "INPUT_DATE")
       public String getInputDate() {
       return inputDate;
       }
      
       public void setInputDate(String inputDate) {
       this.inputDate = inputDate;
       }
      
       @Column(name = "MEMBER_NO")
       public Integer getMemberNo() {
       return memberNo;
       }
      
       public void setMemberNo(Integer memberNo) {
       this.memberNo = memberNo;
       }
      
       @Column(name = "LEVEL_DEPTH")
       public Integer getLevelDepth() {
       return levelDepth;
       }
      
       public void setLevelDepth(Integer levelDepth) {
       this.levelDepth = levelDepth;
       }
      
       @Column(name = "NOTICE_YN")
       public Character getNoticeYn() {
       return noticeYn;
       }
      
       public void setNoticeYn(Character noticeYn) {
       this.noticeYn = noticeYn;
       }
      
       @Column(name = "PARENT_BOARD_SEQ")
       public Integer getParentBoardSeq() {
       return parentBoardSeq;
       }
      
       public void setParentBoardSeq(Integer parentBoardSeq) {
       this.parentBoardSeq = parentBoardSeq;
       }
      
       @Column(name = "REFERER")
       public String getReferer() {
       return referer;
       }
      
       public void setReferer(String referer) {
       this.referer = referer;
       }
      
       @Column(name = "SUBJECT")
       public String getSubject() {
       return subject;
       }
      
       public void setSubject(String subject) {
       this.subject = subject;
       }
      
       @Column(name = "UPDATE_DATE")
       public String getUpdateDate() {
       return updateDate;
       }
      
       public void setUpdateDate(String updateDate) {
       this.updateDate = updateDate;
       }
      
       @Column(name = "VIEW_COUNT")
       public Integer getViewCount() {
       return viewCount;
       }
      
       public void setViewCount(Integer viewCount) {
       this.viewCount = viewCount;
       }
      
       @ManyToOne
       @JoinColumn(name = "LIST_SEQ", insertable = false, updatable = false)
       public BoardList getBoardList() {
       return boardList;
       }
      
       public void setBoardList(BoardList boardList) {
       this.boardList = boardList;
       }
      
       @ManyToOne
       @JoinColumn(name = "PARENT_BOARD_SEQ", insertable = false, updatable = false)
       public Board getParentBoard() {
       return parentBoard;
       }
      
       public void setParentBoard(Board parentBoard) {
       this.parentBoard = parentBoard;
       }
      
       @ManyToOne
       @JoinColumn(name = "MEMBER_NO", insertable = false, updatable = false)
       public JmcMember getJmcMember() {
       return jmcMember;
       }
      
       public void setJmcMember(JmcMember jmcMember) {
       this.jmcMember = jmcMember;
       }
      
       @OneToMany(fetch = FetchType.LAZY, mappedBy = "parentBoard")
       public Collection<Board> getChildBoards() {
       return childBoards;
       }
      
       public void setChildBoards(Collection<Board> childBoards) {
       this.childBoards = childBoards;
       }
      
       @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "board")
       public Collection<BoardFile> getBoardFiles() {
       return boardFiles;
       }
      
       public void setBoardFiles(Collection<BoardFile> boardFiles) {
       this.boardFiles = boardFiles;
       }
      


      and after call a methos ad below, the data of Contents column is cut off
       public Board searchOneWithOneLevel(Integer boardSeq) {
      
       Board board = null;
      
       try {
      
       board = entityManager.find(Board.class, boardSeq);
      
       board.setViewCount(board.getViewCount() + 1);
      
       entityManager.flush();
      
       board.obtainOneLevelChild();
       board.setResultCode(new Integer(1));
       board.setResultMessage(BoardBundle.getString("Success.Search"));
      
       } catch (EntityNotFoundException e) {
      
       logger.error(e.getMessage());
      
       board = new Board();
       board.setResultCode(new Integer(-1));
       board.setResultMessage(BoardBundle.getString("Error.EntityNotFoundException"));
       }
      
       return board;
       }
      


      It seems like a bug.

      # Ritchie.