Tag: java

JPA query.getResultList()?

I use JPA 1.0: Query query; query = em.createNamedQuery(“getThresholdParameters”); query.setParameter(1, Integer.parseInt(circleId)); List<Object[]> resultList = new ArrayList(); resultList = query.getResultList(); Here I get result as List<Object[]>, thus I have to type convert all the parameters of the row to their respective types which is cumbersome. In JPA 2.0 there is TypedQuery which return an entity object […]

more name attributes in Table

Im my SQL Server Database I have 8 tables with the same structure. Now I want to insert in selected tables with one Java class. @Entity @Table(name = “tbl_Prognosen”) //here I want to put all table-Names public class AZBNachricht { … is this possible?

Why CTE query not working in Hibernate?

This is my CTE query String query = “WITH Search(id, name, merchantId, merchantName,merchantNo, purpose, maxDate, paymentAmount) AS (SELECT PAS.GATEWAY_ID AS id, (SELECT NAME FROM GATEWAY_DETAILS WHERE GATEWAY_ID=(SELECT GATEWAY_ID FROM GATEWAY WHERE GATEWAY_ID=PAS.GATEWAY_ID)) AS NAME, PD.merchantName_ID, (SELECT merchantName_NAME FROM merchantName_MASTER WHERE merchantName_ID=PD.merchantName_ID) AS merchantName, PD.TXN_NO, (SELECT MERCHANT_DESC FROM MERCHANTS WHERE DESC_ID=PAS.DESC_ID) AS PURPOSE, PD.TXN_DATE AS maxDate,CHEQUE_AMOUNT […]

How to optimize the insert query time using hiberate?

I have about 1.4 million records of data but it is taking more than 3hr to insert them. I cannot seems to find the problem to it. I read up and change from identity to sequence. It only improved by a little but it still take quite a long time to finish insert. I am […]

can't display video after upload it on SQL Server

I’d like to display a file uploaded on SQL Server. I did that with success when the file is an image(jpg, gif, png, …) But after upload a video on SQL server, I can’t display and play it like this Screenshot looks. Bellow are: The servlet DisplayThoughtFile.java public class DisplayThoughtFile extends HttpServlet { private static […]

Count of rows affected by SELECT INTO query with Microsoft JDBC driver

Is there a way to get a “rows affected” result for SELECT * INTO TableB FROM TableA with Microsoft’s JDBC driver for SQL Server? When I execute that query in SQL Server Management Studio it returns the number of rows the same way as it does for DELETE, INSERT, or UPDATE. I tried executeQuery but […]

Spring Boot application pending when trying to persist to SQL Server

I have a Spring Boot application which I’m trying to use in order to persist some data to a MSSQL instance running as a Docker container (just for dev purposes) on port 1434. I have a @Repository class implementing from CrudRepository: @Repository public interface BookingRepository extends CrudRepository<Booking, Integer> { } And then a @Service class […]

Hibernate sql annotation

I am using Hibernate to interface with SQL Server 2016/Azure SQL Server currently, and have been having a great time with it so far. In my database, I have implemented system versioned temporal tables. I want to map (preferably lazily) two more variables by annotation only to my Hibernate entity that represent the original ValidFrom […]

Merge and When Matched query giving an error sql server

I have a query which I am trying to test. The query should update the data if it finds data in the table with existing primary key. If it doesn’t then insert into the table. The Primary key is of type int and in the properties I can see Identity is set to “True” which […]

“sys.fm_my_permissions” throwing a syntax error with (

When I am trying to execute the following query in sql server management studio 2012 then it showing an Incorrect sytax near ‘(‘ at line –fn_my_permissions(QUOTENAME SELECT s.name, o.name, o.[type], p.[permission_name] FROM sys.objects AS o INNER JOIN sys.schemas AS s ON o.[schema_id] = s.[schema_id] CROSS APPLY sys.fn_my_permissions(QUOTENAME(s.name) + N’.’ + QUOTENAME(o.name), N’OBJECT’) AS p WHERE […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.