New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic entity deserialization exception #249
Comments
well, looks like JaVers thinks that type of id is Serializable, but in fact it is Integer. I will check what we can do about it. |
I've tried to reproduce this exception but without success, could you push failing test which would reproduce this issue? |
Maybe you were using InMemoryRepository? I have the same bug when using the JaversSqlRepository: public abstract class AbstractEntity<T extends Serializable> {
@Id
protected T id;
public abstract T getId();
public abstract void setId(final T id);
} @Entity
public class Account extends AbstractEntity<String> {
@Override
public String getId() {
return id;
}
@Override
public void setId(final String id) {
this.id = id;
}
} Configuring Javers and reproducing the bug using SqlRepository (on MSSQL Server): public static void main(final String[] args) {
final Javers javers = JaversBuilder.javers().
registerJaversRepository(SqlRepositoryBuilder.sqlRepository().
withConnectionProvider(() -> DriverManager.getConnection(
dbUrl, dbUser, dbPw)).
withDialect(DialectName.MSSQL).
build()).
build();
final Account acc = new Account();
acc.setId("1");
javers.commit("User", acc);
javers.commit("User", acc);
} The exception does not occur on the first commit. The entity needs to be present in the snapshot-table. Does not happen with InMemoryRepository. Happens with MappingStyle FIELD and BEAN. |
fix in JSON deserialization of Generic Id property
fix released in JaVers 1.4.10 |
Hi all,
I'm having the following generic base class:
and an implementation
I get the following exception when saving a
Foo
entity:Any idea why it can figure out the type it has to deserialize into?
The text was updated successfully, but these errors were encountered: