From: Gavin K. <ga...@ap...> - 2002-09-23 00:35:16
|
Hi everyone, in response to a user request, I'm adding a BigDecimal type. According to the JDBC spec, the correct mapping for this type is Types.NUMERIC. So we need to go ahead and add a NUMERIC type to all the dialects. To make this a bit easier, would people please let me know what database column type Types.NUMERIC should be mapped to for their platforms? TIA Gavin |
From: Christian M. <vc...@cl...> - 2002-09-23 01:43:34
|
Postgresql column type for types.NUMERIC is numeric --> http://developer.postgresql.org/docs/postgres/datatype.html#DATATYPE-NUMERIC Regards Chris Gavin King wrote: >Hi everyone, > >in response to a user request, I'm adding a BigDecimal type. According to >the JDBC spec, the correct mapping for this type is Types.NUMERIC. So we >need to go ahead and add a NUMERIC type to all the dialects. To make this a >bit easier, would people please let me know what database column type >Types.NUMERIC should be mapped to for their platforms? > >TIA > >Gavin > > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >hibernate-devel mailing list >hib...@li... >https://lists.sourceforge.net/lists/listinfo/hibernate-devel > > > > |
From: Gavin K. <ga...@ap...> - 2002-09-23 02:13:34
|
Cool! Thanks, Doug... Do you know if you need to specify a precision and/or scale value for NUMERIC columns in McKoi ... ie. is there some dumb default value like scale=0? ----- Original Message ----- From: "Doug Currie" <e...@fl...> To: "Gavin King" <ga...@ap...> Sent: Monday, September 23, 2002 11:57 AM Subject: Re: [Hibernate] Whats the correct NUMERIC type for *your* database? > Gavin, > > I put an update to FooBarTest.java into CVS -- it removes restrictions > on MckoiDialect. I have FooBarTested Hibernate with Mckoi 0.94e. > > I added these lines to MckoiDialect.java and placed in CVS: > > public String getSequenceNextValString(String sequenceName) { > return "SELECT UNIQUEKEY('" + sequenceName + "')"; > } > public String getCreateSequenceString(String sequenceName) { > return "CREATE TABLE " + sequenceName + "(id NUMERIC)"; > } > public String getDropSequenceString(String sequenceName) { > return "DROP TABLE " + sequenceName; > } > > Re: your query... I believe Mckoi treats both column types NUMERIC and > DECIMAL equivalently as BigDecimals. > > Regards, > > e > > Sunday, September 22, 2002, 8:34:44 PM, you wrote: > > > Hi everyone, > > > in response to a user request, I'm adding a BigDecimal type. According to > > the JDBC spec, the correct mapping for this type is Types.NUMERIC. So we > > need to go ahead and add a NUMERIC type to all the dialects. To make this a > > bit easier, would people please let me know what database column type > > Types.NUMERIC should be mapped to for their platforms? |
From: Doug C. <e...@fl...> - 2002-09-23 02:42:19
|
> Do you know if you need to specify a precision and/or scale value for > NUMERIC columns in McKoi ... ie. is there some dumb default value like > scale=0? Nope. Mckoi stores NUMERIC as BigDecimal any way you declare it. An unadorned NUMERIC is just fine. e |
From: Anton v. S. <an...@ap...> - 2002-09-23 03:06:34
|
Gavin, Not that this will necessarily forestall all newbie questions about it, but I think the Javadoc for iterator() could be more explicit. It currently says: "Execute a query and return the results in an iterator. Results are lazily instantiated. Write the given value to "?" in the query string. iterate() is usually a less efficient way to retrieve objects than find()." A user might be forgiven for assuming that "lazily instantiated" means that objects are instantiated lazily, when requested, from a single resultset for the entire query. The docs in "6.3 Querying the database" explain this better. Perhaps the last sentence above could be replaced with something like this: "The iterator returned by iterate() will issue a separate database query for each object that is requested, except for objects that are already loaded and cached in the session. In many situations, it is more efficient to use find()." Adjust to reflect reality... :) Anton |
From: Gavin K. <ga...@ap...> - 2002-09-23 03:19:48
|
Yeah, I guess we should improve that part of the documentation. However, in my defence, the documentation includes the following passage. I think "The iterator will load objects on demand" is fairly suggestive...... Quote: ===== If you expect your query to return a very large number of objects, but you don't expect to use them all, you will get better performance from the iterate() methods, which return a java.util.Iterator. The iterator will load objects on demand. Iterator iter = sess.iterate("from q in class eg.Qux"); while ( iter.hasNext() ) { Qux qux = (Qux) iter.next(); // something we couldnt express in the query if ( qux.calculateComplicatedAlgorithm() ) { // delete the current instance iter.remove(); // dont need to process the rest break; } } Unfortunately java.util.Iterator does not declare any exceptions, so any SQL or Hibernate exceptions that occur are wrapped in a LazyInitializationException (a subclass of RuntimeException). The iterate() method also performs better if you expect that many of the objects are already loaded and cached by the session. For small result sets where no data is already cached, find() is a better choice. ----- Original Message ----- From: "Anton van Straaten" <an...@ap...> To: "hibernate list" <hib...@li...> Sent: Monday, September 23, 2002 1:06 PM Subject: [Hibernate] iterator docs > Gavin, > > Not that this will necessarily forestall all newbie questions about it, but > I think the Javadoc for iterator() could be more explicit. It currently > says: > > "Execute a query and return the results in an iterator. Results are lazily > instantiated. Write the given value to "?" in the query string. iterate() > is usually a less efficient way to retrieve objects than find()." > > A user might be forgiven for assuming that "lazily instantiated" means that > objects are instantiated lazily, when requested, from a single resultset for > the entire query. The docs in "6.3 Querying the database" explain this > better. Perhaps the last sentence above could be replaced with something > like this: > > "The iterator returned by iterate() will issue a separate database query for > each object that is requested, except for objects that are already loaded > and cached in the session. In many situations, it is more efficient to use > find()." > > Adjust to reflect reality... :) > > Anton > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel |
From: Anton v. S. <an...@ap...> - 2002-09-23 03:41:44
|
No defense needed, I was just attempting a teensy bit of newbieproofing. :) I think the docs in sec. 6.3 are absolutely fine, but I was thinking of the case where someone reads the Javadoc and doesn't manage to locate the relevant section of the reference docs. This came up because I was going to quote the docs on the forum in reply to that last message, and I found that the Javadoc wasn't suitable for that purpose. Then you beat me to a response again, so I turned my email into a doc update suggestion... :) Anton |
From: Gavin K. <ga...@ap...> - 2002-09-23 03:44:40
|
Heh :) I will make your suggested changes to the Javadoc :) Gavin ----- Original Message ----- From: "Anton van Straaten" <an...@ap...> To: "Gavin King" <ga...@ap...>; "hibernate list" <hib...@li...> Sent: Monday, September 23, 2002 1:41 PM Subject: RE: [Hibernate] iterator docs > No defense needed, I was just attempting a teensy bit of newbieproofing. :) > > I think the docs in sec. 6.3 are absolutely fine, but I was thinking of the > case where someone reads the Javadoc and doesn't manage to locate the > relevant section of the reference docs. This came up because I was going to > quote the docs on the forum in reply to that last message, and I found that > the Javadoc wasn't suitable for that purpose. > > Then you beat me to a response again, so I turned my email into a doc update > suggestion... :) > > Anton |