openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Håkon Sagehaug" <Hakon.Sageh...@bccs.uib.no>
Subject Re: Using object as a type for a filed in a enity
Date Fri, 14 Nov 2008 12:12:04 GMT
Hi

I was to fast here, lookes like I did not solve it anyway, but have done
some debugging that I hope might help in solvingmy problem. I written out
the sql that is sent to the server, which looks like this when I got a
Object as type for a field in my enitty

INSERT INTO objtab (id) VALUES (?)

as you can see it only inserts the id, not the actual value. If I change the
type from Object to String in my java entity, I get this insert statement

INSERT INTO objtab (id, value) VALUES (?, ?)

where the value is also taken, should it be like this. Sinnce the object
maybe is treated as byte type will is show the values in a insert statement?

My entity class looks like this

public class ObjectHolder implements Serializable {

@Id
    @GeneratedValue()
    @Column(name = "id")
    private int id;

    @Column(name = "value")
    private Object theObject;
}

I've tried wiht both bytea and oid as type in my postgresql db, but nothing
seems to work. When I do a select in pgADmin also the column where the value
is supposed to be is empty.

cheers, Håkon

2008/11/14 Håkon Sagehaug <Hakon.Sagehaug@bccs.uib.no>

> Hi
>
> I figured it out, had forgot to map the java filed to the database cloumn.
>
> Thnaks for all the help
>
> cheers, Håkon
>
> 2008/11/14 Jim O'Rourke <jimorourke@clearviewcatv.net>
>
>
>>
>> Not sure it's relevant, but a while back I had trouble with Postgres
>> persisting a blob that represented a jpeg image using 'regular' Hibernate.
>> The resolution was an updated jdbc driver.
>>
>> Do you get what you expect from a psql/pgAdmin direct query ?  Anything in
>> the postgres.log around the INSERT and/or SELECTs?
>> --
>> View this message in context:
>> http://n2.nabble.com/Using-object-as-a-type-for-a-filed-in-a-enity-tp1485319p1496155.html
>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>
>>
>
>
> --
> Håkon Sagehaug, Software Developer
> Parallab, Bergen Center for Computational Science (BCCS)
> UNIFOB AS (University of Bergen Research Company)
>



-- 
Håkon Sagehaug, Software Developer
Parallab, Bergen Center for Computational Science (BCCS)
UNIFOB AS (University of Bergen Research Company)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message