i use the reverse engeneering in my class and get this:
@Entity
@Table(name = "user", catalog = "bytecode", uniqueConstraints =
@UniqueConstraint(columnNames = "email"))
public class User implements java.io.Serializable {
private Integer id;
private String email;
private String password;
private boolean type;
Database:
CREATE TABLE `bytecode`.`user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`type` bit(1) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
But i don't want to set 'true' or 'false' in my attribute 'type' but 1 or 0. How can i do that in hibernate ?
Best regards, Valter Henrique.
I had a similar problem. The following mapping in Java solved my problem:
@Column(name = "columnName", columnDefinition="BIT")
private Boolean columnVariable;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With