You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/07/16 09:08:42 UTC

[GitHub] [incubator-shardingsphere] Saisimon commented on issue #2703: fix #2604 completely

Saisimon commented on issue #2703: fix #2604 completely
URL: https://github.com/apache/incubator-shardingsphere/pull/2703#issuecomment-511733332
 
 
   ```java
   @Entity
   @Table(name="demo")
   @Setter
   @Getter
   @ToString
   public class Demo implements Serializable {
   	
   	private static final long serialVersionUID = -3946482552265049200L;
   
   	@Id
   	@GeneratedValue(strategy=GenerationType.IDENTITY)
   	private Long id;
   	
   	@Column(columnDefinition="BIT(1)")
   	private Boolean column1;
   	
   	@Column(columnDefinition="TINYINT(1)")
   	private Boolean column2;
   	
   	@Column(columnDefinition="BIT(8)")
   	private Byte column3;
   	
   	@Column(columnDefinition="BIT(16)")
   	private Short column4;
   	
   	@Column(columnDefinition="BIT(32)")
   	private Integer column5;
   	
   	@Column(columnDefinition="BIT(64)")
   	private Long column6;
   	
   	@Column(columnDefinition="BIT(64)")
   	private BigDecimal column7;
   	
   }
   ```
   
   ```java
   @SpringBootApplication
   public class DemoApplication {
   	
   	public static void main(String[] args) {
   		try (ConfigurableApplicationContext applicationContext = SpringApplication.run(DemoApplication.class, args)) {
   			DemoRepository demoRepository = applicationContext.getBean(DemoRepository.class);
   			Demo demo = new Demo();
   			demo.setColumn1(true);
   			demo.setColumn2(true);
   			demo.setColumn3(Byte.MAX_VALUE);
   			demo.setColumn4(Short.MAX_VALUE);
   			demo.setColumn5(Integer.MAX_VALUE);
   			demo.setColumn6(Long.MAX_VALUE);
   			demo.setColumn7(new BigDecimal(Long.MAX_VALUE));
   			demoRepository.save(demo);
   			
   			demo = new Demo();
   			demo.setColumn1(false);
   			demo.setColumn2(false);
   			demo.setColumn3((byte) 0);
   			demo.setColumn4((short) 0);
   			demo.setColumn5(0);
   			demo.setColumn6(0L);
   			demo.setColumn7(new BigDecimal(0));
   			demoRepository.save(demo);
   			
   			List<Demo> demos = demoRepository.findAll();
   			for (Demo d : demos) {
   				System.out.println(d.toString());
   			}
   			
   			demoRepository.deleteAll();
   		}
   	}
   	
   }
   ```
   Tested.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services