Search code examples
sql-serverhibernatejakarta-eeormhibernate-native-query

Where can I find a working Java EE sample App that connects to a SQL Server database using Native Queries?


Where can I find a working Java EE sample App that connects to a SQL Server database using Native Queries?

I'm using Eclipse, Microsoft SQL Server Management Studio (SSMS), glassfish,

I need to connect a Java EE application in Eclipse to a database in SSMS.

I need an app that specifically calls the SQL Server using native queries, for example "SELECT * FROM Table".

Thanks


Solution

  • You can find the information you ask in the following sample: https://github.com/javaee-samples/javaee7-samples/tree/master/jpa/native-sql

    For SQL Server you just need to configure the appropriate datasource and the driver of course.

    Here is also a video to help you setup the project: https://www.youtube.com/watch?v=BB4b-Yz9cF0

    Cheers, Roberto