Mapping a private field without property getter fails: new in NH 3.1.0.4000

285 ą²µą³€ą²•ą³ą²·ą²£ą³†ą²—ą²³ą³
ą²®ą³Šą²¦ą²²ą³ ą²“ą²¦ą²¦ ą²øą²‚ą²¦ą³‡ą²¶ą²•ą³ą²•ą³† ą²øą³ą²•ą²æą²Ŗą³ ą²®ą²¾ą²”ą²æ

Oliver Friedrich

ą²“ą²¦ą²¦ą²æą²°ą³ą²µą³ą²¦ą³,
ą²®ą²¾ą²°ą³ą²šą³ 17, 2011, 06:23:47 ą²…ą²Ŗą²°ą²¾ą²¹ą³ą²Ø17/3/11
ą²—ą³† nhu...@googlegroups.com
Hi all, I'm having the following problem with version 3.1:

I used to map the private fields of a certain class
privateĀ int?Ā _positiveValue;
privateĀ int?Ā _negativeValue;

using the following hbm.xml:

<propertyĀ name="PositiveValue"Ā access="field.camelcase-underscore"Ā />
<propertyĀ name="NegativeValue"Ā access="field.camelcase-underscore"Ā />

This worked fine with NH <= 3.0, but with 3.1.0.4000 I get an error while building the session factory:

[PropertyNotFoundException: Could not find the property 'PositiveValue', associated to the field '_positiveValue', in class '...UsefulnessEntry']
   NHibernate.Properties.FieldAccessor.GetGetter(Type theClass, String propertyName) +248
   NHibernate.Util.ReflectHelper.ReflectedPropertyClass(String className, String name, String accessorName) +131
...

[MappingException: Could not compile the mapping document: ...UsefulnessEntry.hbm.xml]
...

I did not have any property getters defined for my private fields. Now it seems to be forced by NH 3.1. When I add them as follows the error vanishes:

privateĀ int?Ā PositiveValueĀ {Ā getĀ {Ā returnĀ _positiveValue;Ā }Ā }

privateĀ int?Ā NegativeValueĀ {Ā getĀ {Ā returnĀ _negativeValue;Ā }Ā }
I would consider this a regression and I'm wondering if this is by design or by accident. Can anybody shed light on this new behaviour?
Cheers, Oliver
_____________


---Ā  Eulers IdentitƤt ---

Roger Kratz

ą²“ą²¦ą²¦ą²æą²°ą³ą²µą³ą²¦ą³,
ą²®ą²¾ą²°ą³ą²šą³ 18, 2011, 08:34:05 ą²Ŗą³‚ą²°ą³ą²µą²¾ą²¹ą³ą²Ø18/3/11
ą²—ą³† nhu...@googlegroups.com

http://216.121.112.228/browse/NH-2556

Ā 

If you donā€™t have any property, map it using access=ā€fieldā€.

--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.

Fabio Maulo

ą²“ą²¦ą²¦ą²æą²°ą³ą²µą³ą²¦ą³,
ą²®ą²¾ą²°ą³ą²šą³ 18, 2011, 12:29:33 ą²…ą²Ŗą²°ą²¾ą²¹ą³ą²Ø18/3/11
ą²—ą³† nhu...@googlegroups.com
This mapping
<propertyĀ name="PositiveValue"Ā access="field.camelcase-underscore"Ā />
mean:
For my property named "PositiveValue" you (NH) have to access to the field; to discover which is theĀ associatedĀ field you (NH) have to use the strategy "camelcase-underscore".

If there is no property you can't use the accessor with a specific strategy.

--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.



--
Fabio Maulo

Fabio Maulo

ą²“ą²¦ą²¦ą²æą²°ą³ą²µą³ą²¦ą³,
ą²®ą²¾ą²°ą³ą²šą³ 18, 2011, 12:30:54 ą²…ą²Ŗą²°ą²¾ą²¹ą³ą²Ø18/3/11
ą²—ą³† nhu...@googlegroups.com
Note: you property does not have to be public.
--
Fabio Maulo

ą²Žą²²ą³ą²²ą²°ą²æą²—ą³‚ ą²Ŗą³ą²°ą²¤ą³ą²Æą³ą²¤ą³ą²¤ą²°ą²æą²øą²æ
ą²²ą³‡ą²–ą²•ą²°ą²æą²—ą³† ą²Ŗą³ą²°ą²¤ą³ą²Æą³ą²¤ą³ą²¤ą²°ą²æą²øą²æ
ą²«ą²¾ą²°ą³ą²µą²°ą³ą²”ą³ ą²®ą²¾ą²”ą²æ
0 ą²¹ą³Šą²ø ą²øą²‚ą²¦ą³‡ą²¶ą²—ą²³ą³