-->
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.  [ 26 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: NHibernate 1.2 to 2.0 Breaking Changes
PostPosted: Mon Mar 31, 2008 11:00 am 
Hibernate Team
Hibernate Team

Joined: Tue Jun 13, 2006 11:29 pm
Posts: 315
Location: Calgary, Alberta, Canada
With the release of NHibernate 2.0.0.Alpha1, there are also a few breaking changes:

Compile time
  • Changed NHibernate.Expression namespace to NHibernate.Criterion
  • Changed NHiberante.Property namespace to NHiberante.Properties
  • IInterceptor changed to match the Hibernate 3.2 Interceptor
  • INamingStrategy interface changed
  • Changes to IType, IEntityPersister, IVersionType
  • IBatcher interface change

Initialization time
  • <nhibernate> section is ignored, using <hibernate-configuration> section (note that they have different XML formats)
  • Configuration values are no longer prefixed by "hibernate.", if before you would specify "hibernate.dialect", now you specify just "dialect"
  • Will perform validation on all named queries at initialization time, and throw exception if any is not valid.

Run time
  • SaveOrUpdateCopy() returns a new instance of the entity without change the original.
  • No AutoFlush outside a transaction - Database transactions are never optional, all communication with a database has to occur inside a transaction, no matter if you read or write data.
  • NHibernate will return long for count(*) queries on SQL Server
  • <formula> must contain parenthesis when needed


If you find anything we have missed, please post a comment here and let us know.

NOTE: Credit goes to Ayende Rahien and Fabio Maulo for compiling this list.

_________________
Karl Chu


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 31, 2008 11:23 am 
Contributor
Contributor

Joined: Tue May 30, 2006 1:25 am
Posts: 29
There are some not documented features as well:

Session:
Merge
Persist

Mapping:
New comma separated cascade style like H3.2.5
unionsubclass
on-delete

and probably something else.... at this point I forgot my name ;)

_________________
Fabio Maulo.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 31, 2008 12:06 pm 
Newbie

Joined: Thu Dec 21, 2006 1:41 pm
Posts: 4
Talking with Fabio in the Spanish forum, he suggeted to add this ones under the "Breaking Change for External framework" category:

- ICacheProvider: Now it's using some generic classes
- ICriterion
- CriteriaQueryTranslator


Bye,
Diego


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 31, 2008 12:16 pm 
Contributor
Contributor

Joined: Tue May 30, 2006 1:25 am
Posts: 29
Initialization Time new features:
default_batch_fetch_size
adonet.factory_class (is BatchingBatcherFactory)
adonet.wrap_result_sets
adonet.batch_size
default_schema
default_catalog
query.startup_check
generate_statistics
query.factory_class (only if somebody want to write the AST parser ;) )
query.startup_check
sql_exception_converter

If somebody have time to work in something would useful some Batcher for some other RDBMS and ISQLExceptionConverter implementation for all RDBMS (take a look to NHibernate.Test.ExceptionsTest )

_________________
Fabio Maulo.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 31, 2008 12:17 pm 
Newbie

Joined: Mon Mar 31, 2008 12:12 pm
Posts: 1
diegojancic wrote:
Talking with Fabio in the Spanish forum, he suggeted to add this ones under the "Breaking Change for External framework" category:

- ICacheProvider: Now it's using some generic classes
- ICriterion
- CriteriaQueryTranslator


Bye,
Diego


All classes that was in NHibernate.Expressions namespace now are in NHibernate.Criterion.

http://groups.google.it/group/nh-it/browse_thread/thread/263ee2fb5e1ee7a3


Bye
Massimo


Top
 Profile  
 
 Post subject: IInterceptor.IsUnsaved
PostPosted: Mon Mar 31, 2008 6:06 pm 
Newbie

Joined: Sat Jun 11, 2005 1:56 am
Posts: 19
IInterceptor.IsUnsaved has been removed.

Has this been replaced by IInterceptor.IsTransient??

Thanks

Guido Tapia


Top
 Profile  
 
 Post subject: Re: IInterceptor.IsUnsaved
PostPosted: Mon Mar 31, 2008 7:04 pm 
Contributor
Contributor

Joined: Tue May 30, 2006 1:25 am
Posts: 29
gatapia wrote:
IInterceptor.IsUnsaved has been removed.
Has this been replaced by IInterceptor.IsTransient??


Yes, same name/concept of H3.2.5

_________________
Fabio Maulo.


Top
 Profile  
 
 Post subject: What happened to ValueTypeType?
PostPosted: Sat Apr 05, 2008 11:29 am 
Newbie

Joined: Thu Jul 19, 2007 6:49 am
Posts: 13
I noticed that the ValueTypeType type is gone in 2.0.0 alpha 1. I was using it to create my own CharBooleanTYpe that stores a boolean as J/N (Dutch for yes/no). How should I fix this?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 05, 2008 12:20 pm 
Hibernate Team
Hibernate Team

Joined: Tue Jun 13, 2006 11:29 pm
Posts: 315
Location: Calgary, Alberta, Canada
It is recommended that one implements IUserType to create user types. See here:
http://www.hibernate.org/hib_docs/nhibe ... pes-custom

_________________
Karl Chu


Top
 Profile  
 
 Post subject: Re: What happened to ValueTypeType?
PostPosted: Mon Apr 07, 2008 9:13 am 
Contributor
Contributor

Joined: Tue May 30, 2006 1:25 am
Posts: 29
dionysos1973 wrote:
I noticed that the ValueTypeType type is gone in 2.0.0 alpha 1. I was using it to create my own CharBooleanTYpe that stores a boolean as J/N (Dutch for yes/no). How should I fix this?


The name is PrimitiveType (this is another breaking change).
BTW, for this issue, is better the simple use of "query.substitutions" or inherit your type from YesNoType.
Before write a new class only to have a different value for a bool take a look to the configuration property query.substitutions.

Thanks to remember us this other BR.
Bye.

_________________
Fabio Maulo.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 08, 2008 12:47 pm 
Newbie

Joined: Thu Jul 19, 2007 6:49 am
Posts: 13
Thanks fabiomaulo, but query substituions won't help me here. I need to make sure NH maps a VARCHAR(1) column with the values 'J' or 'N' to an ordinary System.Boolean. And you can't derive from the YesNoType since it does not expose the required constructors (to be more precise, BooleanCharType doesn't).

Thanks anyway..
Dennis


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 08, 2008 1:23 pm 
Contributor
Contributor

Joined: Tue May 30, 2006 1:25 am
Posts: 29
dionysos1973 wrote:
And you can't derive from the YesNoType since it does not expose the required constructors (to be more precise, BooleanCharType doesn't).


This is not the thread to talk about it but sure you can inherit from CharBooleanType and you have all you need to override it in the same way YesNoType do it.
Bye.

_________________
Fabio Maulo.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 24, 2008 4:24 am 
Newbie

Joined: Thu Apr 24, 2008 4:19 am
Posts: 1
connection.provider seems to be required in the configuration now.

Not certain though, error messages were less than clear.


Top
 Profile  
 
 Post subject: problem with minute and datediff
PostPosted: Tue Jun 03, 2008 2:13 pm 
Newbie

Joined: Tue Apr 01, 2008 3:54 pm
Posts: 1
datediff function in sql has three options to define the difference result type as a minute: minute, mi, n.
If you used minute it used to work in previous NH version but in NH 2.0 won't work because minute is a reserved word for HQL function minute. A list of the reserved words (HQL functions) is:

substring
locate
trim
length
bit_length
coalesce
nullif
abs
mod
sqrt
upper
lower
cast
extract
concat
current_timestamp
sysdate
second
minute
hour
day
month
year
str


Top
 Profile  
 
 Post subject: Nullables
PostPosted: Fri Jun 06, 2008 9:52 am 
Newbie

Joined: Fri Jun 06, 2008 9:47 am
Posts: 1
Pehaps a stupid question, but what has happened with Nullables and NHibernate.Nullables?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 26 posts ]  Go to page 1, 2  Next

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.