Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 886633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:06:04+00:00 2026-05-15T13:06:04+00:00

I’m having problems using Hibernate and SQL Server 2008. When I try to save

  • 0

I’m having problems using Hibernate and SQL Server 2008. When I try to save an object to database Hibernate throws this:

could not retrieve snapshot: com.my.MyClass

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

The user has select, insert,update privileges in database. So I ruled that problem out.

This is the SQL generated:

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 says invalid object name emanagement.patient_visit, but if I manually add that “dbo” emanagement.dbo.patient_visit than it will get exsecuted.

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

This is my Hibernate mapping. The below mapping works under MySQL. I can read and update patient_visit in database. But when switching to MS Server it fails.
I have tried other hibernate mappings which work for both MySQL and MS Server and they both use the same declarations as below like table=”db_table” schema=”my_database”.
The only difference is that I created this new emanagement database under MS Server, so I’m thinking that I missed some specific database configuration on the MS Server management tool.
The only way to prove this is for me to move the new tables from emanagement to an existing database and see if it works.

<class name="com.domain.patient.model.PatientVisit" table="patient_visit"    schema="emanagement">
        <id name="accountNumber" type="java.lang.Long">
            <column name="account_number" precision="22" scale="0" />
            <generator class="assigned"/>
        </id> 
        <property name="status" type="string">
            <column name="status"/>
        </property>
        <property name="cptCode" type="string">
            <column name="cpt_code"/>
        </property> 
        <property name="locked" type="boolean">
            <column name="locked" precision="1" scale="0"/>
        </property>  
        <property name="state" type="string">
            <column name="state"/>
        </property>  
        <property name="userId" type="string">
            <column name="userid"/>
        </property>  
               <set name="documents" lazy="false">
            <key column="account_number"/>
            <one-to-many class="com.domain.document.model.Document"/>
        </set>     
    </class>

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T13:06:04+00:00Added an answer on May 15, 2026 at 1:06 pm

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

    With your current setup, I guess you’ll have to specify the schema. For example, in the mapping:

    <class name="Users" table="Users" schema="dbo" catalog="suiteaccess">
    

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

    Just in case, you can create your own schema.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 442k
  • Answers 442k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer collinodell, startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse("tel:*%23*%232432546%23*%23*"))); I got it today by hex… May 15, 2026 at 6:01 pm
  • Editorial Team
    Editorial Team added an answer How are you doing your validation? +[NSCharacterSet alphanumericCharacterSet] includes Japanese… May 15, 2026 at 6:01 pm
  • Editorial Team
    Editorial Team added an answer To implement radio button as the editable instead of the… May 15, 2026 at 6:01 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.