Hey guys!
I'm trying to get my first Hibernate / SQL Server (express) project off the ground and I'm having a really weird time getting going. At this point, I can do the reveng strategy and select objects without issue; however, I cannot get any object to INSERT into the database. I don't get any errors or questionable behavior, but it just will not insert, either through merge, save or saveOrUpdate.
It's very curious because the select works fine.
The table is a very simple, one field varchar( 50 ) and the mapping file looks correct. I thought it might be a permission issue on the SQL Server end of some kind, but I am able to insert through a JDBC Connection without issue, so I think it might be something in my hibernate file.
Has anyone had this problem before? Thanks for any help getting me on track?
Hibernate Cfg:
Code:
<hibernate-configuration>
<session-factory name="SQLServerFactory">
<property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="hibernate.connection.password">mysqlserverpass</property>
<property name="hibernate.connection.url">jdbc:sqlserver://localhost:1433;databaseName=FGPartsMaster</property>
<property name="hibernate.connection.username">rroot</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<mapping resource="com/hs/fga/common/client/model/EvanTest.hbm.xml" />
</session-factory>
</hibernate-configuration>
EvanTest mapping:
Code:
<hibernate-mapping>
<class name="com.hs.fga.common.client.model.EvanTest" table="evanTest" schema="dbo" catalog="FGPartsMaster">
<id name="name" type="string">
<column name="Name" length="50" />
</id>
</class>
</hibernate-mapping>
Table:
Code:
CREATE TABLE [dbo].[evanTest](
[Name] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
Hibernate Java:
Code:
EvanTest eT = new EvanTest();
eT.setName( "My Name Test" );
Session session = HibernateFactory.getSessionFactory().openSession();
session.save( eT ); // Also tried .merge(), .saveOrUpdate() to no avail
session.close();