-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: getting a objets for a bytea type data
PostPosted: Sat Jul 09, 2005 2:21 am 
Newbie

Joined: Sat Jul 09, 2005 2:17 am
Posts: 3
Hello.

im trying to do get a bytea from my database like this:

Cover c = (Cover)session.Load (typeof(Cover),id);

and i get this output:

Quote:
Unhandled Exception: NHibernate.ADOException: could not load object ---> System.ArgumentException: An invalid argument was specified.
in [0x000a0] System.Array:CopyTo (System.Array array, Int32 index)
in [0x00027] (at /usr/ports/lang/mono/work/mono-1.1.7/mcs/class/Npgsql/Npgsql/NpgsqlDataReader.cs:504) Npgsql.NpgsqlDataReader:GetBytes (Int32 i, Int64 fieldOffset, System.Byte[] buffer, Int32 bufferoffset, Int32 length)
in <0x000c8> NHibernate.Type.BinaryType:Get (IDataReader rs, Int32 index)
in <0x000b7> NHibernate.Type.NullableType:NullSafeGet (IDataReader rs, System.String name)
etc.



how do i fix this?


here is Cover.cs:

Code:
public class Cover{
   private byte[] pix;
   private int id;
   public Cover(){}
   public byte[] Image{
      get { return pix; }
      set { pix = value; }
   }
   public int Id{
      get {return id;}
      set {id=value;}
   }
}


thanks in advance!


Top
 Profile  
 
 Post subject: database looks like
PostPosted: Sat Jul 09, 2005 2:22 am 
Newbie

Joined: Sat Jul 09, 2005 2:17 am
Posts: 3
Database:
[code]music=> \d disco
Tabla


Top
 Profile  
 
 Post subject: xml
PostPosted: Sat Jul 09, 2005 2:29 am 
Newbie

Joined: Sat Jul 09, 2005 2:17 am
Posts: 3
sorry.. i missed this one too.

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" namespace="RadioNet" assembly="Library">
   <class name="Cover" table="disco">
      <id name="Id" column="id_disco" type="integer">
         <generator class="assigned" />
      </id>
      <property name="Image" column="imagen"/>
   </class>
</hibernate-mapping>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.