I have a "Billing" class with a field of type "Username" declared as:
@CheckForNull @Columns(columns= {@Column(name="processed_by_provider"), @Column(name="processed_by_name")}
) private Username processedBy;
Class "Username" is a simple POJO with two fields: "provider" and "name".
The implementation of CompositeUserType interface is straightforward and attached to the issue. It is registered globally as:
Configuration config = new Configuration().configure("hibernate.cfg.xml"); config.registerTypeOverride(new PersistentUsername()); SessionFactory result = config.buildSessionFactory();
It works fine as long I am using classical hibernate functionality, but not with batch processing. HQL for batch update:
u = session.createQuery("UPDATE Billing r SET r.processedBy = :uname WHERE r.id = :u"); u.setParameter("uname", username); u.setParameter("u", id); int count = u.executeUpdate();
Generate the following illegal SQL:
update billing set processed_by_provider, processed_by_name=(?, ?) where id=?
Expected is something like this:
update billing set processed_by_provider=?, processed_by_name=? where id=?
|