Hi All, 
We have an PR for GTNPORTAL-3530 https://github.com/gatein/gatein-portal/pull/895
This PR help to overwrite mapping file HibernateIdentityObjectAttribute.hbm.xml that map almost attributes to nvarchar

But beside firstName, lastName, and displayName. Currently, user can also put UTF-8 to fields when creating new Group and Membership.
For example, I create a new Group with GroupName: Tuyến --> It raises exception in the server log. I guess this problem also comes from UTF-8 issue with nvarchar

The same issue with Membership:
MembershipName: điểm
Description: mô tả
--> Exceptions raised:
[http-bio-8080-exec-11] ERROR portal:UIPortalApplication - Error during the processAction phase
java.lang.NullPointerException
at org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl.createRelationship(HibernateIdentityStoreImpl.java:1162)
at org.picketlink.idm.impl.repository.WrapperIdentityStoreRepository.createRelationship(WrapperIdentityStoreRepository.java:245)
at org.picketlink.idm.impl.api.session.managers.RoleManagerImpl.createRole(RoleManagerImpl.java:284)
at org.picketlink.idm.impl.api.session.managers.RoleManagerImpl.createRole(RoleManagerImpl.java:318)
at org.exoplatform.services.organization.idm.MembershipDAOImpl.linkMembership(MembershipDAOImpl.java:162)
at org.exoplatform.organization.webui.component.UIGroupForm$SaveActionListener.execute(UIGroupForm.java:172)


My question is: we should also map those attributes to nvarchar column ? Or we add validator and don't allow user to create Group and Membership with UTF-8 name ?



On Thu, Aug 7, 2014 at 5:02 PM, Tuyen The Nguyen <tuyennt@exoplatform.com> wrote:
Hi Bolesław,

Thank you for your answer,

I saw the way we did with Sysbase and i think we can fix this issue in a similar way.

I'm going to continue working on this issue.

Thank you again,

Nguyen The Tuyen.







On Wed, Aug 6, 2014 at 2:11 PM, Bolesław Dawidowicz <bdawidow@redhat.com> wrote:
Hi,

I'm not a DB expert however from what I see your observations are correct:

http://stackoverflow.com/questions/176514/what-is-the-difference-between-char-nchar-varchar-and-nvarchar-in-sql-server

As a temporary workaround it should be doable to simply alter the table
and change the column type.

We'll need to look at the issue - I don't have a fix for hibernate
mappings on top of my head. If there is a need for special mappings just
for SQL Server 2008 it is doable with current setup - we already have
separate hibernate mapping files for Sybase for very similar reason.


On 08/06/2014 04:28 AM, Tuyen The Nguyen wrote:
> Hi GateIn team,
>
> When i run GateIn with MSSQL server 2008, i face with a problem that
> special UTF-8 character in display name appears not correctly.
>
> The use-case is:
> - Run GateIn using MSSQL server instead of HSQL
> - Login to user root then update profile with first name, last name and
> display name contain special UTF-8 character, for example my name is
> "Nguyễn Thế Tuyến"
> - After save my profile, display name appears correctly at top-right corner.
> - Restart GateIn and login with root again.
>    Now, display name appears incorrectly at top-right, i goto my profile
> and i see my first name, last name and display name appears incorrectly
> too, all special UTF-8 character are replaced by "?" character.
> I reported issue at https://issues.jboss.org/browse/GTNPORTAL-3530
>
> After spend some time for investigating, i see this problem is caused by
> PL IDM can not store UTF-8 string into database correctly.
> MSSQL Server requires column type must be NVARCHAR for storing UTF-8
> string but Picketlink IDM generated table with column type is VARCHAR
> for storing text value.
>
> I know PL IDM use hibernate, so I tried to find the way to configure
> picketlink-hibernate and hope it will generate table column type
> NVARCHAR or it can store UTF-8 string in VARCHAR column type but i
> can't. I have no more idea to resolve this problem.
>
> May be you can help me with some suggestion about how to store UTF-8
> string with MSSQL Server.
> Please, any help is welcome.
>
> Thanks,
> Nguyen The Tuyen.
>
>
> _______________________________________________
> gatein-dev mailing list
> gatein-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/gatein-dev
>



--
Bolesław Dawidowicz
JBoss Portal Platform Architect | GateIn Portal Project Lead
_______________________________________________
gatein-dev mailing list
gatein-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/gatein-dev


_______________________________________________
gatein-dev mailing list
gatein-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/gatein-dev