Tuesday, 15 March 2011

hibernate - AttributeConverter fails after migration from glassfish 4 to wildfly 8.1 -



hibernate - AttributeConverter fails after migration from glassfish 4 to wildfly 8.1 -

i have entity:

import java.io.serializable; import javax.persistence.*; import java.util.list; @entity @table(name="user") @namedquery(name="user.findall", query="select u user u") public class user implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy=generationtype.identity) @column(unique=true, nullable=false) private int id; @column(nullable=false) private boolean aktiv; ... }

and converter:

import javax.persistence.attributeconverter; import javax.persistence.converter; @converter(autoapply = true) public class booleanconverter implements attributeconverter<boolean, byte> { @override public byte converttodatabasecolumn(boolean value) { if (value) { homecoming 1; } else { homecoming 0; } } @override public boolean converttoentityattribute(byte value) { homecoming 1 == value.bytevalue(); } }

this works fine glassfish 4.0.

but on wildfly 8.1 same code produces:

javax.persistence.persistenceexception: org.hibernate.hibernateexception: unknown wrap conversion requested: [b java.lang.byte @ org.hibernate.jpa.spi.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1763)

(if remove "aktiv" column works.)

any thought problem is?

works if byte replaced integer. mysql's 'tinyint' mapped byte default. attributeconverter works attributeconverter<boolean, integer>

hibernate jpa glassfish wildfly-8

No comments:

Post a Comment