Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Hibernate Enum persistence with GenericEnumUserType

807603Jan 27 2008 — edited Jan 27 2008
I am using the custom user type found at

http://www.hibernate.org/272.html

to persist some Enums. I have some domain objects that have compound ids; the ids are composed of 3 (different) enums. sometimes i intentionally have null for one of those enums.

The problem is when I persist and object with a compound key containing a null enum, when I then load that object null for the entire object is returned (instead of just the key component that that should be null). I have a test where i save the object with null key component; I verify in the db via jdbc that object is saved -- its coming out of the database that is broxed.

here are the important methods from the user type
   public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {  
        Object identifier = type.get(rs, names[0]);
        if (rs.wasNull()) {
            return null;
        }
        
        try {
            return valueOfMethod.invoke(enumClass, new Object[] { identifier });
        } catch (Exception e) {
            throw new HibernateException("Exception while invoking valueOf method '" + valueOfMethod.getName() + "' of " +
                    "enumeration class '" + enumClass + "'", e);
        }
    }

    public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
        try {
            if (value == null) {
//                st.setNull(index, type.sqlType());
                st.setObject(index, null);
            } else {
                Object identifier = identifierMethod.invoke(value, new Object[0]);
                type.set(st, identifier, index);
            }
        } catch (Exception e) {
            throw new HibernateException("Exception while invoking identifierMethod '" + identifierMethod.getName() + "' of " +
                    "enumeration class '" + enumClass + "'", e);
        }
    }

Comments

Jitendra Vishnoi

I don't think endeca 11.2 and win10 are compatible(Baseline update failing), win10 is not mentioned in support matrix for 11.2

3523679

Hi,

thanks for the information @"Jitendra Vishnoi" .

thanks

-Biswa

Daciano

Hello, I have used endeca 11.2 on windows 10, I had no problems.

I suggest checking the dgidx log to identify the problem that is occurring.

Is in: ..\logs\dgidxs\Dgidx\Dgidx\Dgidx.log

If you can not identify the problem copy the dgidx log here for us.

I hope I have helped.

sri075109

Hello,

Can you check whether MDEX path is set correctly in PlatformServices\workspace\conf\eac.properties.

user13687585

Biswa,

Have you find the solution for your dgidx issue? I have same issue with Windows 10. Please share your solution.

Thanks,

-Srini

user13687585

Could you share the document that has compatibility information?

Thanks,

-Srini

Avinash-Oracle

Endeca 11.2 and 11.3 is not compatible with windows10.

Thanks,

Avinash Dewangan

1 - 7
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Feb 24 2008
Added on Jan 27 2008
1 comment
551 views