Fixed type-erasure problem when extending Hibernate API.