Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

Hibernate, Postgresql: Column "x" is of type oid but expression is of type byte -


i have strange problem regarding hibernate mapping containing large objects (blob), when switching between different databases.

@lob private byte[] binarydata; 

the field above creates byte array field in mysql , in oracle, in postresql creates field of type oid.

now when try access field works fine in other databases, in postgresql fails following error

column "binarydata" of type oid expression of type bytea. 

so tried remove "@lob" annotation, solve problem postgresql, in mysql without annotation, hibernate creates field of type "tinyblob", small in of our cases. and, want use project in more 1 environment annoying have 2 different mappings switch.

is there annotation forces postgresql use bytea instead of oid fields annotated @lob? or somehow possible omit @lob , put else in order force mysql allocate larger datatype using @lob?

i imagine have solution this

if (field of type oid)   store oid else if (field of type bytea)   store bytea else   // not storable 

and same getter, if there exists way kind of this

edit:

the following declaration working. allocates column oid, hibernate using knows how store , retrieve data such field

@lob @type(type="org.hibernate.type.primitivebytearrayblobtype") private byte[] binaryfile; 

this field mapping defined in org.hibernate.dialect.postgresqldialect , can changed subclassing , configuring app use modified dialect when running postgres.

the relevant incantation in subclass put

    registercolumntype( types.blob, "bytea" ); 

in constructor after call super().


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -