nhibernate dialect error : seems to be a bug - nhibernate

I am using an oracle database, so defined dialect as Oracle9Dialect.
But it throws error :
"Could not load type NHibernate.Dialect.
Oracle9Dialect. Possible
cause: no assembly name specified."
I just change the dialect as MsSql2000Dialect without changing
driver_class, it works. But, in this case i cannot use oracle spesific
features..
any suggestions?
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="NHibernate.Test">
<property name="connection.driver_class">NHibernate.Driver.OracleDataClientDriver</ property>
<property name="connection.connection_string">
User ID=hr;Password=hr;Data Source=192.168.189.4/orcl
</property>
<property name="adonet.batch_size">10</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="use_outer_join">true</property>
<property name="command_timeout">60</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
<mapping assembly="CoreHR" />
</session-factory>
</hibernate-configuration>

There's no longer a class called NHibernate.Dialect.Oracle9Dialect in NHibernate 2.1. The class is now called NHibernate.Dialect.Oracle9iDialect.

Related

Could not create the driver from NHibernate.Driver.SybaseAseClientDriver

My Configuration is like this:
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">
NHibernate.Dialect.SybaseASE15Dialect
</property>
<property name="connection.driver_class">
NHibernate.Driver.SybaseAseClientDriver
</property>
<property name="connection.connection_string">
********
</property>
</session-factory>
</hibernate-configuration>
I am getting this exception: Could not create the driver from NHibernate.Driver.SybaseAseClientDriver while creating configuration.
Could somebody please help me figure out this issue?
It worked for me after I changed the driver to OleDbDriver.
<property name="connection.driver_class">
NHibernate.Driver.OleDbDriver
</property>

wso2 is secondary user store authentication

I have a wso2 is 5.1.0 server runign on Debian. I have a simple servlet that is authenticating using Oauth2 and works perfectly with the users in the primary store.
I have created a secondary store pointing to an openldap server. I have some users and groups and are seen correctly from the IS. I see that when I try to see the User Profile i get the following error:
Error while loading user profile metadata
But when I try to authenticate using the users in the ldap server i get a Login Failed error. I have tried to use both username, DOMAIN/username and username#DOMAIN but none of the worked.
I am starting to think that it could be related to the Calim configuration as the users in the different stores have different values but I don't know how to solve it.
Any ideas on what I am doing wrong?
UPDATED:
This is how I have defined the secondary store.
<?xml version="1.0" encoding="UTF-8"?><UserStoreManager class="org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager">
<Property name="ConnectionURL">ldap://xxxx:389</Property>
<Property name="ConnectionName">cn=admin,dc=xx,dc=xx</Property>
<Property encrypted="true" name="ConnectionPassword">xxxx</Property>
<Property name="UserSearchBase">ou=users,dc=nextel,dc=es</Property>
<Property name="UserEntryObjectClass">inetOrgPerson</Property>
<Property name="UserNameAttribute">cn</Property>
<Property name="UserNameSearchFilter">(&(objectClass=person)cn=?))</Property>
<Property name="UserNameListFilter">(objectClass=person)</Property>
<Property name="UserDNPattern"/>
<Property name="DisplayNameAttribute"/>
<Property name="Disabled">false</Property>
<Property name="ReadGroups">true</Property>
<Property name="WriteGroups">true</Property>
<Property name="GroupSearchBase">ou=groups,dc=xx,dc=xx</Property>
<Property name="GroupEntryObjectClass">groupOfNames</Property>
<Property name="GroupNameAttribute">cn</Property>
<Property name="GroupNameSearchFilter">(&(objectClass=groupOfNames)(cn=?))</Property>
<Property name="GroupNameListFilter">(objectClass=groupOfNames)</Property>
<Property name="RoleDNPattern"/>
<Property name="MembershipAttribute">member</Property>
<Property name="MemberOfAttribute"/>
<Property name="BackLinksEnabled">false</Property>
<Property name="UserNameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
<Property name="UserNameJavaScriptRegEx">^[\S]{3,30}$</Property>
<Property name="UsernameJavaRegExViolationErrorMsg">Username pattern policy violated.</Property>
<Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property>
<Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
<Property name="PasswordJavaRegExViolationErrorMsg">Password pattern policy violated.</Property>
<Property name="RoleNameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
<Property name="RoleNameJavaScriptRegEx">^[\S]{3,30}$</Property>
<Property name="SCIMEnabled">false</Property>
<Property name="BulkImportSupported">true</Property>
<Property name="EmptyRolesAllowed">true</Property>
<Property name="PasswordHashMethod">PLAIN_TEXT</Property>
<Property name="MultiAttributeSeparator">,</Property>
<Property name="MaxUserNameListLength">100</Property>
<Property name="MaxRoleNameListLength">100</Property>
<Property name="kdcEnabled">false</Property>
<Property name="defaultRealmName">WSO2.ORG</Property>
<Property name="UserRolesCacheEnabled">true</Property>
<Property name="ConnectionPoolingEnabled">false</Property>
<Property name="ReadTimeout">5000</Property>
<Property name="LDAPConnectionTimeout">5000</Property>
<Property name="RetryAttempts">0</Property>
<Property name="DomainName">incloudLDAP</Property>
<Property name="Description"/>
</UserStoreManager>
I can see the users in the list and even create a new one on the LDAP through WSO2 Is, but i cannot see the parameters.
UPDATED:
THe user structure in the LDAP is quite simple.
For the authentication issue, you need to verify "UserNameSearchFilter" attribute is correctly configured. It must mapped to the user name attribute in your ladp server.
<Property name="UserNameSearchFilter">(&(objectClass=user)(cn=?))</Property>
Also you can map attibutes from different user stores to a same wso2 claim. In the mapped attibute section use something like follows,
PRIMARY/attribute1;FOO/attribute2;BAR/attribute3
Also refer - https://docs.wso2.com/display/IS510/Adding+Claim+Mapping

NHibernate Configuration Settings

This is my Configuration file. I have a database that name is Basin.
My sql server editon is 2012 express.
also, My Project name is NHibernate_Test
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
<propert name="query.substitutions">hqlFunction=SQLFUNC</propert>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">Data Source=(local);Initial Catalog=Basin; Integrated Security=True; </property>
<property name="show_sql">true</property>
<mapping assembly="NHibernate_Test"/>
</session-factory> </hibernate-configuration> </configuration
But I am getting a error
Error : An exception occurred parsing configuration :The element 'session-factory' in namespace 'urn:nhibernate-configuration-2.2' has invalid child element 'propert' in namespace 'urn:nhibernate-configuration-2.2'. List of possible elements expected: 'property, mapping, class-cache, collection-cache, event, listener' in namespace 'urn:nhibernate-configuration-2.2'.
It is at the line:
<propert name="query.substitutions">hqlFunction=SQLFUNC</propert>
exactly as in the exception:
..has invalid child element 'propert' in namespace..
we need
<property...
see the property with y at the end

JPA PagingItemReader with PostgreSQL

I have done a job that reads data from a db and writes it in a file. It works fine with an Oracle DB. However, when I use it with Postgres I get the following error:
org.postgresql.util.PSQLException: ERROR: subquery in FROM must have an alias
Hint: Por ejemplo, FROM (SELECT ...) [AS] foo.
Position: 15
Error Code: 0
The reader is defined as follows:
<bean id="myReader"
class="org.springframework.batch.item.database.Jpa PagingItemReader">
<property name="entityManagerFactory" ref="entityManagerFactory" />
<property name="queryString" value="select c from CountryEntity c" />
<property name="pageSize" value="1000"/>
</bean>
Does anybody know if this is a common issue related with Postgres? Do I need to use a specific configuration?
You need to configure your JPA provider to use the PostGreSQL dialect.
E.g. for Hibernate, you would use a setup (persistence.xml) like this:
<persistence-unit name="somename" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
<property name="hibernate.connection.url" value="jdbc:postgresql:sample"/>
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>

Nhibernate 2.0.1 with mono

I've build my WinForm app on windows machine and the app is working
ok. When I user nhibernate 1.2.1 the app also worked on linux machine
using mono, but now when i upgraded app to nhibernate 2.0.1 it works
only in windows.
I've get error:
NHibernate.InvalidProxyTypeException: The following types may not be
used as proxies:
xxxx.Data.Dao.Credit : method obj_address should be virtual
......
Can anyone help me with this problem?
You can try and disable the NHibernate Config proxy validator. it seems to not work with mono.
You can do this by adding:
<property name="use_proxy_validator">false</property> in your app/web.config nhibernate section.
For an example config with this property set, see here:
http://www.mail-archive.com/nhusers#googlegroups.com/msg02109.html
or modify this:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<!--
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">Data Source=YOUR_DB_SERVER;Database=Northwind;User ID=YOUR_USERNAME;Password=YOUR_PASSWORD;</property>
<property name="connection.isolation">ReadCommitted</property>
<property name="default_schema">Northwind.dbo</property>
-->
<!--
<property name="dialect">NHibernate.Dialect.SQLiteDialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SQLiteDriver</property>
<property name="connection.connection_string">Data Source=nhibernate.db;Version=3</property>
<property name="query.substitutions">true=1;false=0</property>
-->
<!-- mysql
<property name="dialect">NHibernate.Dialect.MySQLDialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.MySqlDataDriver</property>
<property name="connection.connection_string">Database=test</property>
-->
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.NpgsqlDriver</property>
<property name="connection.connection_string">Server=localhost;database=test;User id=jrwren;password=yourpasswordhere.</property>
<property name="dialect">NHibernate.Dialect.PostgreSQLDialect</property>
<property name="use_proxy_validator">false</property>
<!-- HBM Mapping Files -->
<mapping assembly="Test.exe" />
</session-factory>
</hibernate-configuration>
</configuration>
This might be of interest:
http://softwaredevscott.spaces.live.com/blog/cns!1A9E939F7373F3B7!251.entry
I'm also on mono trying to use NHibernate. Most forums seem to say setting the string to virtual will fix the problem, but this hasn't worked for me. What is curious is that my error is almost identical -
"" method obj_address should be virtual
This makes me think the proxy "address" is reserved for something else. Try changing the name of this column?