« Return to Thread: The Java type [null] is not a valid database type -- any clues?

Re: The Java type [null] is not a valid database type -- any clues?

by James Sutherland :: Rate this Message:

Reply to Author | View in Thread

This error is odd, please log a detailed bug for it include the object model/annotations and the error message.  The default mapping should be able to determine the column type in most cases.

ljnelson wrote:
On Mon, Jun 29, 2009 at 2:03 PM, Laird Nelson <ljnelson@gmail.com> wrote:

> On Mon, Jun 29, 2009 at 12:44 PM, Laird Nelson <ljnelson@gmail.com> wrote:
>
>> I've gotten this error while marking up some Entities and running them
>> through unit tests.  Both Hibernate and OpenJPA deal with my setup just
>> fine, but it looks like at EntityManagerFactory creation time, EclipseLink
>> barfs with this error.  I've reproduced the stack below.
>
>
> Through some blind trial and error, I found where this bug is.
>
> I have one entity, call it B, that has an @EmbeddedId field that consists
> of four columns.
>
> I have another entity, call it A, that has a @ManyToOne relationship with
> B.  The field in question is annotated like this:
>
> @ManyToOne
> private B b;
>

And that is the problem.  I have not specified the full regiment of
@JoinColumns.

So, to recap: "Java type [null] is not a valid database type" actually means
"You forgot to specify @JoinColumns on your @ManyToOne relationship."

Interestingly, neither Hibernate nor OpenJPA seem to mind--who's correct
here?

Best,
Laird

 « Return to Thread: The Java type [null] is not a valid database type -- any clues?