Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE DATABASE `test_db` /*!40100 DEFAULT CHARACTER SET utf8 */;
- CREATE TABLE `atable` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `shortText` varchar(255) DEFAULT NULL,
- `longText` blob,
- PRIMARY KEY (`id`),
- UNIQUE KEY `id` (`id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
- @Entity(name = "atable")
- public class AClass{
- @Id
- @Column(name = "id", unique = true)
- @GeneratedValue
- Long id;
- @Column
- private String shortText; //also exists setter and getter, of course
- private byte[] longText;
- public void setLongText(String s){this.longText = (s!=null)?s.getBytes():null;}
- public String getLongText(){return this.longText!=null?new String(longText):null;}
- }
- jdbc:mysql://localhost:3306/app_db?useUnicode=true&characterEncoding=utf8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement