-->
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.  [ 5 posts ] 
Author Message
 Post subject: hbm2java problem with properties that have unique="true
PostPosted: Mon Feb 23, 2004 6:52 am 
Newbie

Joined: Mon Feb 23, 2004 6:43 am
Posts: 8
Location: Irvine, California, USA
Hi!

Even if a property has the unique="true" attribute, the autogenerated finder always returns a list.

_________________
Nikolay Kolev
Webgineers


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 23, 2004 5:16 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes - to avoid complexity and what if you have more than one property in the finder ?


p.s. unique and not-null is more a hint to the schemaexport tool than hints to hibernatecore or hbm2java.....but if you want you are welcome to add a JIRA request for it...even better provide a patch ;) (even though I like the simplicity of the current implementation that don't prevent anything vital as I see it...but I'm willing to be proved wrong ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: I'll try to do a patch
PostPosted: Mon Feb 23, 2004 10:34 pm 
Newbie

Joined: Mon Feb 23, 2004 6:43 am
Posts: 8
Location: Irvine, California, USA
I understand the intended SchemaExport use, but it would be nice to broaden it. Poluting the app with code like this:

Code:
List list = AbcFinder.findXyz(session, value);
if (!list.isEmpty())
{
    Abc found = (Abc)list.get(0);
    // some code
}

compared to the cleaner:

Code:
Abc found = AbcFinder.findXyz(session, value);
if (found != null)
{
    // some code
}

makes no sense to me.

So, I'll submit a request to JIRA and I'll try to provide a patch. It should be pretty easy to do, but probably I would have to add a <param/> to the BasicRenderer for backward compatibility.

_________________
Nikolay Kolev
Webgineers


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 16, 2004 10:35 am 
Newbie

Joined: Thu Dec 16, 2004 9:00 am
Posts: 5
Reviving this topic - did this ever make it into the production release?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 16, 2004 1:30 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
i don't remember receiving a jira request/patch for it...so no.

_________________
Max
Don't forget to rate


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