-->
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.  [ 13 posts ] 
Author Message
 Post subject: how to use patch on Criteria.count() method?
PostPosted: Mon Jan 05, 2004 1:09 am 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-474
I wanna count function on h2 and I found the patch. But how to use it? What is the different between patch.txt and src-patch.txt?
I think this function is very useful, why not add it to h2 project? Is there any disadvantage of this patch?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 05, 2004 12:45 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Grab hibernate from cvs and apply the patch using your favorite IDE (pretty easy with Eclipse Team->apply patch)

src applies on src directory and non-src applies on the whole distribution.

Developpers need to take time to think about that (don't want to add a wrong and thus legacy API). There was a thread on the devel mailing list about that.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 05, 2004 12:45 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
patch.txt is the newer one. To apply it use the patch utility found in any *nix, or for example eclipses "Apply Patch" function. The function ist not available with hibernate right now, because there is still an ongoing thinking process about how to include accumulation functions most elegantly in the API


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 07, 2004 1:28 am 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
My IDE is JBuilder8, I didn't find any function like "Apply Patch".
To epbernard:
What is your meaning of
Quote:
To apply it use the patch utility found in any *nix
? I copy code fragment begin with "+" from patch.txt replace source code then delete "+" in code. So boring! Is there any easy way to do that or a tool? Why not offer some files to replace origin source files?
For src/net/sf/hibernate/loader/AbstractEntityLoader.java, patch.txt shows:
public AbstractEntityLoader(Loadable persister, SessionFactoryImplementor factory) {
super( factory.getDialect() );
this.persister = persister;
@@ -103,7 +105,7 @@

JoinFragment ojf = mergeOuterJoins(associations);

- sql = new Select()
+ select = new Select()
.setSelectClause(
persister.joinSelectFragment( alias, suffixes[joins] ) +
selectString(associations, factory)
@@ -117,8 +119,9 @@
ojf.toFromFragmentString(),
ojf.toWhereFragmentString() + getWhereFragment()
)
- .setOrderByClause(orderBy)
- .toStatementString();
+ .setOrderByClause(orderBy);
+
+ sql = select.toStatementString();

}

But in origin source file AbstractEntityLoader.java is:
public AbstractEntityLoader(Loadable persister, SessionFactoryImplementor factory) {
super( factory.getDialect() );
this.persister = persister;
alias = generateRootAlias( persister.getClassName() );
}
There is a line code: alias = generateRootAlias( persister.getClassName() ); It is not appear in patch.txt. How to do with this line, delete it or remain it?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 07, 2004 1:29 am 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
My IDE is JBuilder8, I didn't find any function like "Apply Patch".
To epbernard:
What is your meaning of
Quote:
To apply it use the patch utility found in any *nix
?
I copy code fragment begin with "+" from patch.txt replace source code then delete "+" in code. So boring! Is there any easy way to do that or a tool? Why not offer some files to replace origin source files?
For src/net/sf/hibernate/loader/AbstractEntityLoader.java, patch.txt shows:
public AbstractEntityLoader(Loadable persister, SessionFactoryImplementor factory) {
super( factory.getDialect() );
this.persister = persister;
@@ -103,7 +105,7 @@

JoinFragment ojf = mergeOuterJoins(associations);

- sql = new Select()
+ select = new Select()
.setSelectClause(
persister.joinSelectFragment( alias, suffixes[joins] ) +
selectString(associations, factory)
@@ -117,8 +119,9 @@
ojf.toFromFragmentString(),
ojf.toWhereFragmentString() + getWhereFragment()
)
- .setOrderByClause(orderBy)
- .toStatementString();
+ .setOrderByClause(orderBy);
+
+ sql = select.toStatementString();

}

But in origin source file AbstractEntityLoader.java is:
public AbstractEntityLoader(Loadable persister, SessionFactoryImplementor factory) {
super( factory.getDialect() );
this.persister = persister;
alias = generateRootAlias( persister.getClassName() );
}
There is a line code: alias = generateRootAlias( persister.getClassName() ); It is not appear in patch.txt. How to do with this line, delete it or remain it?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 07, 2004 1:55 am 
Pro
Pro

Joined: Tue Aug 26, 2003 8:07 pm
Posts: 229
Location: Brisbane, Australia
Related to the issue of applying patches, I have a question about creating patches.

I can't actually get access to the CVS repository (firewall issues). So what I do is use the source code that comes bundled with the distribution archive these days. I keep one completely clean copy of the source base (acting as my baseline) and one copy that I make my changes on.

My questions is: from where (ie. what directory) should I apply the "diff -u" in order that the patch file created can be used by whatever mechanism you guys use to apply the patch files?

_________________
Cheers,
Shorn.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 07, 2004 3:50 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
fafnir wrote:
What is your meaning of
Quote:
To apply it use the patch utility found in any *nix
?

well, try 'man patch' on a unix/linux box.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 07, 2004 4:35 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Or try cygwin if you are using Windows


Top
 Profile  
 
 Post subject: New patch needed
PostPosted: Mon Jan 12, 2004 8:20 pm 
Newbie

Joined: Wed Jan 07, 2004 5:30 pm
Posts: 11
Location: SF, CA
Could someone please provide an update patchfile which works with the CVS head?

The criteria API seems to have changed a lot and the current patch doesn't appear to work for me, either in Eclipse nor command-line. Thanks.


Top
 Profile  
 
 Post subject: Patch now in JIRA for 2.1.1
PostPosted: Sun Jan 25, 2004 7:01 pm 
Newbie

Joined: Sat Nov 15, 2003 12:24 pm
Posts: 4
All,

As the creator of this patch, I'm afraid I didn't actually see this forum thread on it until just recently. I have just attached a new version of patch.txt in JIRA, against the root directory of version 2.1.1. This version of patch.txt is the second, slightly larger one, as I can't figure out how to rename files attached in JIRA, and I don't have permission to remove the old one.

Also, for the convenience of those who don't need/want to build from source, I attached a compiled hibernate2.jar (also version 2.1.1) with this patch applied. If you like this patch, don't forget to vote in JIRA. I find it rather frustrating to have to keep redoing this patch for every new release. Perhaps someone on the hibernate dev team will add this vital functionality to the main codebase if the user community says it needs it badly enough.

--Chris


Top
 Profile  
 
 Post subject: DOH!
PostPosted: Tue Jan 27, 2004 12:19 am 
Newbie

Joined: Sat Nov 15, 2003 12:24 pm
Posts: 4
I'm afraid the first 2.1.1 patch had a silly error on my part. Try again at:
http://opensource.atlassian.com/project ... key=HB-474

The filenames are: hibernate211-patched.jar for the jar and patch-2.1.1.txt for the patch itself.

--Chris


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 31, 2004 3:55 am 
Newbie

Joined: Sat Jan 31, 2004 3:49 am
Posts: 1
Thanks for the binary patch - it works and did what I expected it to.

I've also voted for this on JIRA, this new criteria API is great for doing nice clean dynamic searchs from user supplied data for scrolling through collections of search results but without the count() you can't implement next/prev buttons sensibly.

- Richard Perfect.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 9:56 pm 
Newbie

Joined: Wed Feb 04, 2004 5:50 am
Posts: 1
I also need this function, and vote it.


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