-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: UserType
PostPosted: Wed May 18, 2005 1:56 pm 
Newbie

Joined: Wed May 18, 2005 1:47 pm
Posts: 2
Location: ru
Hibernate version: 2.1.7c

This is my UserType class file.

Code:
public class MoneyType implements UserType {

    private static final int[] SQL_TYPES = new int[]{Types.DECIMAL};

    public int[] sqlTypes() {
        return SQL_TYPES;
    }

    public Class returnedClass() {
        return Money.class;
    }

    public boolean equals(Object o, Object o1) throws HibernateException {
        return o.equals(o1);
    }

    public Object nullSafeGet(ResultSet resultSet, String[] strings, Object o) throws HibernateException, SQLException {
        Money money = new Money();
        money.setAmount((BigDecimal) Hibernate.BIG_DECIMAL.nullSafeGet(resultSet, strings[0]));
        return money;
    }

    public void nullSafeSet(PreparedStatement preparedStatement, Object o, int i) throws HibernateException, SQLException {
        Hibernate.BIG_DECIMAL.nullSafeSet(preparedStatement, ((Money)o).getAmount(), i);
    }

    public Object deepCopy(Object o) throws HibernateException {
        Money m = new Money();
        m = (Money) ((Money) o).clone();
        return m;
    }

    public boolean isMutable() {
        return false;
    }
}



Why "owner the containing entity" in nullSafeGet method is always setted to null ?
Is it my mistake ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.