-->
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.  [ 8 posts ] 
Author Message
 Post subject: Hibernate creates multiple instances of same UserType(s)
PostPosted: Sun Jan 25, 2004 7:36 pm 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
We are heavily using UserType(s) and noticed that Hibernates creates multiple instances of the same UserType.
To be more accurate, it creates a new instance for every mapped property that uses it.

Some of our UserType(s) are quite heavy (construction time and memory consumption). I'm wondering if Hibernate could create a single instance and reuse it every time it needs it - as it already does for regular types...

Any comment ?

Note: using Hibernate 2.1.1


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 25, 2004 7:40 pm 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
Note2: that same behavior is observed for CompositeUserType(s)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2004 1:37 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Can you post it to JIRA for good tracking ?

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2004 5:19 am 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
JIRA entry HB-644 created (http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-644)

Do you want me to submit a patch or is this part of the code too "sensitive" ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2004 5:35 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Feel free to attatch a patch, Gavin will surely detect if it breaks anything :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2004 7:29 am 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
gloeglm wrote:
Feel free to attatch a patch, Gavin will surely detect if it breaks anything :)


First question
I spotted two places in the code where UserTypes are created:
- in Hibernate.custom()
- in TypeFactory.heuristicType()

The TypeFactory already makes reference to Hibernate.* methods where the singleton for native types are defined.

My question now is where should I create the pool of UserType instances ?
According to the names, I would do it in the TypeFactory. But doing so will introduce circular dependencies between Hibernate and TypeFactory...

It seems the best place is therefore in Hibernate (class) itself.
Any opinion ?

Second question
The PersistentEnum(s) suffer from the same 'problem'.
Wondering if we could pool them as well ?
Are there any other types like those ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2004 7:32 am 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
I've posted these questions as comments to the JIRA entry.
I don't think the Beginners forum is the best place to discuss them.
I will post a summary in the forum once the JIRA entry is closed.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2004 11:40 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I am -1 on this change; please see my comments in the JIRA issue.


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