Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-19-2012, 07:05 PM   #1
Senior Member
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,045
Blog Entries: 1

Rep: Reputation: 83
Ebean: exception when a field that is related to another entity is null


I have this entity where either one of two fields has to be set and they both point to a different entity.

I have both fields set as @ManyToOne and have set their @JoinColumns accordingly.

For the sake of the example, say entity A has a field that is related to entity B and another to entity C. They are supposed to be mutually exclusive, if you set b then c will be null and viceversa.

Something like:

public class A {

    private B b;
    private C c;

At the moment I'm using only one of the fields so if I comment out the other unused field (and it's getter/setter) I can use the entity without a single hiccup.

However, when I uncomment it (but don't set anything on it..... or even if I set it to null) I get this exception when I try to save a new instance of A:

javax.persistence.PersistenceException: ERROR executing DML bindLog[] error[Unknown Types value.]
	at com.avaje.ebeaninternal.server.persist.dml.DmlBeanPersister.execute(
	at com.avaje.ebeaninternal.server.persist.dml.DmlBeanPersister.insert(
	at com.avaje.ebeaninternal.server.persist.DefaultPersistExecute.executeInsertBean(
	at com.avaje.ebeaninternal.server.core.PersistRequestBean.executeNow(
	at com.avaje.ebeaninternal.server.core.PersistRequestBean.executeOrQueue(
	at com.avaje.ebeaninternal.server.persist.DefaultPersister.insert(
	at com.avaje.ebeaninternal.server.persist.DefaultPersister.saveVanillaInsert(
	at com.avaje.ebeaninternal.server.persist.DefaultPersister.saveVanillaRecurse(
	at com.avaje.ebeaninternal.server.persist.DefaultPersister.saveRecurse(
	at la.cps.warp.daemon.DaemonClient.processMessage(
	at la.cps.warp.daemon.DaemonClient.getMessage(
Caused by: org.postgresql.util.PSQLException: Unknown Types value.
	at org.postgresql.jdbc2.AbstractJdbc2Statement.setNull(
	at org.postgresql.jdbc3.AbstractJdbc3Statement.setNull(
	at org.postgresql.jdbc4.AbstractJdbc4Statement.setNull(
	at com.avaje.ebeaninternal.server.lib.sql.ExtendedPreparedStatement.setNull(
	at com.avaje.ebeaninternal.server.type.DataBind.setNull(
	at com.avaje.ebeaninternal.server.type.ScalarTypeUUID.bind(
	at com.avaje.ebeaninternal.server.type.ScalarTypeUUID.bind(
	at com.avaje.ebeaninternal.server.deploy.BeanProperty.bind(
	at com.avaje.ebeaninternal.server.persist.dml.DmlHandler.bindInternal(
	at com.avaje.ebeaninternal.server.persist.dml.DmlHandler.bind(
	at com.avaje.ebeaninternal.server.persist.dmlbind.BindableAssocOne.dmlBind(
	at com.avaje.ebeaninternal.server.persist.dmlbind.BindableAssocOne.dmlBind(
	at com.avaje.ebeaninternal.server.persist.dmlbind.BindableList.dmlBind(
	at com.avaje.ebeaninternal.server.persist.dml.InsertMeta.bind(
	at com.avaje.ebeaninternal.server.persist.dml.InsertHandler.bind(
	at com.avaje.ebeaninternal.server.persist.dml.DmlBeanPersister.execute(
	... 16 more
Why is that? Keep in mind (just in case) that the @Id field for B and C is a UUID field (don't know how this affects it but there you go).

Thanks in advance.


ebean, java, uuid

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ebean: why is Ebean trying to do an update by doing where with all fields? eantoranz Programming 3 08-30-2012 02:33 PM
[SOLVED] Count occurrence of character in field and print in a new field Trd300 Linux - Newbie 5 03-21-2012 07:57 PM
"null pointer exception" Ubuntu vp702x dicksch Ubuntu 2 01-30-2012 07:21 PM
[SOLVED] awk: how to print a field when field position is unknown? elfoozo Programming 12 08-18-2010 03:52 AM
help createing exception class from base STL exception qwijibow Programming 4 04-20-2005 05:23 AM

All times are GMT -5. The time now is 06:55 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration