-->
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.  [ 2 posts ] 
Author Message
 Post subject: Pass Null Using Primitive types
PostPosted: Mon Jan 19, 2004 9:27 pm 
Beginner
Beginner

Joined: Thu Oct 23, 2003 1:43 pm
Posts: 23
Hi,

Is there anyway I can pass NULL to Database using primitive types. I have to use objects to pass NULL to nullable columns. I just want to know is there a way to pass NULL using primitive types.

This is what I have:

public class A{

Long _id;
Float _variable // Nullable object.

}

But I want to use like this:

public class A{

Long _id;
float _variable // Nullable primitive

}

The reason is my object takes up lot of memory for each object inside it. I would rather want to use primitives and can still pass NULL somehow to DB if it has a zero or negative values. Please help.

[b]NOTE: The above code is just a sample. Curently each of our object occupies close to 300 bytes. There is a significant change in the size if I replace Nullable objects with primitive types which in this case occupies just 98 bytes.[/b]

Regards,
Raghu


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 19, 2004 10:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
use a UserType


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.