-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6067970
commit c08c11e
Showing
2 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
avni-server-api/src/test/java/org/avni/server/dao/GeneralRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.avni.server.dao; | ||
|
||
import jakarta.persistence.EntityManager; | ||
import jakarta.persistence.Query; | ||
import org.hibernate.query.sql.internal.NativeQueryImpl; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public class GeneralRepository { | ||
private final EntityManager entityManager; | ||
|
||
@Autowired | ||
public GeneralRepository(EntityManager entityManager) { | ||
this.entityManager = entityManager; | ||
} | ||
|
||
public long execute(String sql) { | ||
Query query = entityManager.createNativeQuery(sql); | ||
NativeQueryImpl nativeQuery = (NativeQueryImpl) query; | ||
return nativeQuery.getResultCount(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters