SQLServerDialect Override to register nvarchar type in Spring Boot
I am facing an issue with nvarchar type of SQL server and need to register it in Spring Boot Application.Since I am calling the existing stored procedure, I do not have an option to cast in query. Kindly suggest me if any other way to deal with nvarchar
I am using JPA repository to call the Stored Procedure
@Repository
public interface CustomRepo extends JpaRepository<ArchEntity, Long>
@Query(value = "call dbo.storedproc(:objectType)", nativeQuery = true)
public List<Object> getData(@Param("objectType") String type);
Properties
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
spring.datasource.initialize=false
spring.datasource.url=jdbc:sqlserver:**********
spring.datasource.username=*****
spring.datasource.password=*****
And exception is
2018-11-13 09:43:02 - Servlet.service() for servlet
[dispatcherServlet] in context with path threw exception [Request
processing failed; nested exception is
org.springframework.orm.jpa.JpaSystemException: No Dialect mapping for JDBC
type: -9; nested exception is org.hibernate.MappingException: No Dialect
mapping for JDBC type: -9] with root cause
org.hibernate.MappingException: No Dialect mapping for JDBC type: -9
at org.hibernate.dialect.TypeNames.get(TypeNames.java:70)
at org.hibernate.dialect.TypeNames.get(TypeNames.java:101)
at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:666)
at
sql-server hibernate spring-boot jpa
add a comment |
I am facing an issue with nvarchar type of SQL server and need to register it in Spring Boot Application.Since I am calling the existing stored procedure, I do not have an option to cast in query. Kindly suggest me if any other way to deal with nvarchar
I am using JPA repository to call the Stored Procedure
@Repository
public interface CustomRepo extends JpaRepository<ArchEntity, Long>
@Query(value = "call dbo.storedproc(:objectType)", nativeQuery = true)
public List<Object> getData(@Param("objectType") String type);
Properties
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
spring.datasource.initialize=false
spring.datasource.url=jdbc:sqlserver:**********
spring.datasource.username=*****
spring.datasource.password=*****
And exception is
2018-11-13 09:43:02 - Servlet.service() for servlet
[dispatcherServlet] in context with path threw exception [Request
processing failed; nested exception is
org.springframework.orm.jpa.JpaSystemException: No Dialect mapping for JDBC
type: -9; nested exception is org.hibernate.MappingException: No Dialect
mapping for JDBC type: -9] with root cause
org.hibernate.MappingException: No Dialect mapping for JDBC type: -9
at org.hibernate.dialect.TypeNames.get(TypeNames.java:70)
at org.hibernate.dialect.TypeNames.get(TypeNames.java:101)
at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:666)
at
sql-server hibernate spring-boot jpa
nvarchar should just be a java String, this seems like you are missing the right JPA settings in properties file. Can you update the question with datasource and jpa
– Chirdeep Tomar
Nov 13 '18 at 8:54
Updated with properties @ChirdeepTomar
– Nagaraja R
Nov 13 '18 at 9:03
add a comment |
I am facing an issue with nvarchar type of SQL server and need to register it in Spring Boot Application.Since I am calling the existing stored procedure, I do not have an option to cast in query. Kindly suggest me if any other way to deal with nvarchar
I am using JPA repository to call the Stored Procedure
@Repository
public interface CustomRepo extends JpaRepository<ArchEntity, Long>
@Query(value = "call dbo.storedproc(:objectType)", nativeQuery = true)
public List<Object> getData(@Param("objectType") String type);
Properties
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
spring.datasource.initialize=false
spring.datasource.url=jdbc:sqlserver:**********
spring.datasource.username=*****
spring.datasource.password=*****
And exception is
2018-11-13 09:43:02 - Servlet.service() for servlet
[dispatcherServlet] in context with path threw exception [Request
processing failed; nested exception is
org.springframework.orm.jpa.JpaSystemException: No Dialect mapping for JDBC
type: -9; nested exception is org.hibernate.MappingException: No Dialect
mapping for JDBC type: -9] with root cause
org.hibernate.MappingException: No Dialect mapping for JDBC type: -9
at org.hibernate.dialect.TypeNames.get(TypeNames.java:70)
at org.hibernate.dialect.TypeNames.get(TypeNames.java:101)
at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:666)
at
sql-server hibernate spring-boot jpa
I am facing an issue with nvarchar type of SQL server and need to register it in Spring Boot Application.Since I am calling the existing stored procedure, I do not have an option to cast in query. Kindly suggest me if any other way to deal with nvarchar
I am using JPA repository to call the Stored Procedure
@Repository
public interface CustomRepo extends JpaRepository<ArchEntity, Long>
@Query(value = "call dbo.storedproc(:objectType)", nativeQuery = true)
public List<Object> getData(@Param("objectType") String type);
Properties
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
spring.datasource.initialize=false
spring.datasource.url=jdbc:sqlserver:**********
spring.datasource.username=*****
spring.datasource.password=*****
And exception is
2018-11-13 09:43:02 - Servlet.service() for servlet
[dispatcherServlet] in context with path threw exception [Request
processing failed; nested exception is
org.springframework.orm.jpa.JpaSystemException: No Dialect mapping for JDBC
type: -9; nested exception is org.hibernate.MappingException: No Dialect
mapping for JDBC type: -9] with root cause
org.hibernate.MappingException: No Dialect mapping for JDBC type: -9
at org.hibernate.dialect.TypeNames.get(TypeNames.java:70)
at org.hibernate.dialect.TypeNames.get(TypeNames.java:101)
at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:666)
at
sql-server hibernate spring-boot jpa
sql-server hibernate spring-boot jpa
edited Nov 13 '18 at 9:02
Nagaraja R
asked Nov 13 '18 at 8:51
Nagaraja RNagaraja R
44
44
nvarchar should just be a java String, this seems like you are missing the right JPA settings in properties file. Can you update the question with datasource and jpa
– Chirdeep Tomar
Nov 13 '18 at 8:54
Updated with properties @ChirdeepTomar
– Nagaraja R
Nov 13 '18 at 9:03
add a comment |
nvarchar should just be a java String, this seems like you are missing the right JPA settings in properties file. Can you update the question with datasource and jpa
– Chirdeep Tomar
Nov 13 '18 at 8:54
Updated with properties @ChirdeepTomar
– Nagaraja R
Nov 13 '18 at 9:03
nvarchar should just be a java String, this seems like you are missing the right JPA settings in properties file. Can you update the question with datasource and jpa
– Chirdeep Tomar
Nov 13 '18 at 8:54
nvarchar should just be a java String, this seems like you are missing the right JPA settings in properties file. Can you update the question with datasource and jpa
– Chirdeep Tomar
Nov 13 '18 at 8:54
Updated with properties @ChirdeepTomar
– Nagaraja R
Nov 13 '18 at 9:03
Updated with properties @ChirdeepTomar
– Nagaraja R
Nov 13 '18 at 9:03
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53277085%2fsqlserverdialect-override-to-register-nvarchar-type-in-spring-boot%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53277085%2fsqlserverdialect-override-to-register-nvarchar-type-in-spring-boot%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
nvarchar should just be a java String, this seems like you are missing the right JPA settings in properties file. Can you update the question with datasource and jpa
– Chirdeep Tomar
Nov 13 '18 at 8:54
Updated with properties @ChirdeepTomar
– Nagaraja R
Nov 13 '18 at 9:03