Problems when using Hibernate and SQL Server 2008

I have a problem with Hibernate and SQL Server 2008. When I try to save an object to the database, Hibernate will throw this:

could not retrieve snapshot: com.my.MyClass

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name `'emanagement.patient_visit'.`< /pre>

Users have select, insert, and update permissions in the database. So I excluded this problem.

This is generated by SQL:

select
patientvis_.account_number,
patientvis_.status as status1_,
patientvis_.cpt_code as cpt3_1_,
patientvis_.locked as locked1_,
patientvis_.state as state1_,
patientvis_.userid as userid1_
from
emanagement.patient_visit patientvis_
where
patientvis_.account_number=?

If I am in SQL Server Run the above SQL in, it will say invalid object name emanagement.patient_visit, but if I manually add "dbo" emanagement.dbo.patient_visit, then it will be evicted.

Then I need to do anything Any other Hibernate configuration?

This is my Hibernate mapping. The following mapping runs under MySQL. I can read and update patient_visit in the database. But when switching to MS Server it fails.
I have tried others Hibernate mapping for MySQL and MS Server, they all use the same declaration as below, such as table = "db_table" schema = "my_database".
The only difference is that I created this new emanagement database under MS Server , So I think I missed some specific database configuration on the MS Server management tool.
The only way to prove this is for me to transfer the new table from emanagement to the existing database and see if it works.
p>





< /id>



















Thanks in advance.

So is there any other Hibernate configuration I need to make?

According to your current settings, I guess you must specify the architecture. For example, in the mapping:

But you can also use the hibernate.default_schema attribute to specify the default schema (see 3.4. Optional configuration properties).

Just in case, you can create your own schema.

I encountered when using Hibernate and SQL Server 2008 Problem. When I try to save the object to the database, Hibernate throws this:

could not retrieve snapshot: com.my.MyClass

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name ` 'emanagement.patient_visit'.`

Users have select, insert, and update permissions in the database. So I excluded this problem.

This is generated by SQL:

select
patientvis_.account_number,
patientvis_.status as status1_,
patientvis_.cpt_code as cpt3_1_,
patientvis_.locked as locked1_,
patientvis_.state as state1_,
patientvis_.userid as userid1_
from
emanagement.patient_visit patientvis_
where
patientvis_.account_number=?

If I run the above SQL in SQL Server, it will say invalid object name emanagement.patient_visit, but if I manually add "dbo" emanagement.dbo.patient_visit, then it will be evicted.

So do I need to do any other Hibernate configuration?

This is my Hibernate mapping. The following mapping runs under MySQL. I can read and update patient_visit in the database. But when switching to MS Server it fails.
I have tried others Hibernate mapping for MySQL and MS Server, they all use the same declaration as below, such as table = "db_table" schema = "my_database".
The only difference is that I created this new emanagement database under MS Server , So I think I missed some specific database configuration on the MS Server management tool.
The only way to prove this is for me to transfer the new table from emanagement to the existing database and see if it works.
p>





< /id>



















Thanks in advance.

So is there any other Hibernate configuration I need to make?

According to your current settings, I guess you must specify the architecture. For example, in the mapping:

But you can also use the hibernate.default_schema property to specify the default schema (see 3.4. Optional configuration properties).

Just in case, you can create your own schema.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4507 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.