0

As a result of this question, I found a bug in Hibernate 3.6.x that was solved in 4.1.8. I have "upgraded" my JBoss 6.1 by deleting the hibernate libraries from common/lib and replacing with the new ones.

More concretely, I did delete:

  • hibernate-commons-annotations.jar (replaced by hibernate-commons-annotations-4.0.1.Final.jar)

  • hibernate-core.jar (replaced by hibernate-core-4.1.8.Final.jar)

  • hibernate-entitymanager.jar (replaced by hibernate-entitymanager-4.1.8.Final.jar)

  • hibernate-jpa-2.0-api.jar (replaced by hibernate-jpa-2.0-api-1.0.1.Final.jar)

I did keep hibernate-validator.jar and hibernate-validator-legacy.jar as I didn't find a likely sustitute for them.

Now, the server starts without complaining but when it tries to map an Entity with a boolean attribute, it is trying to create a boolean field in SQLServer 2008 (which uses the type bit), causing that those tables are not created. Tables without boolean attributes do work right, though.

What I am doing wrong? My persistence.xml which worked fine prior to the upgrade has not been changed, and I don't find a reference to a new SQLServer dialect, so I am assuming my upgrade process was botched and I left something out. Any suggestions?

Just for the record, I am using JBoss6.1, JPA2.0 on top of Hibernate and SQL Server Express 2008.

Thanks in advance.

1 Answer 1

2

In the annotation for your boolean fields try specifying a columnDefinition.

@Column(name="IS_APPROVED", columnDefinition="bit")
private boolean isApproved;
Sign up to request clarification or add additional context in comments.

3 Comments

Ok, this has worked, thanks (so far I can only test the table creation process). Anyway I think it is a workaround; as this solution binds my application to SQLServer in the code and so I am losing some advantages of JPA. I will wait for a more "standard" answer (if that exists) before accepting this answer.
@Sjuan76 Maybe you will get a better answer, but its always nice to know there is a solution. Best of luck!
I guess I'll try to move to JBoss 7.1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.