Questions tagged [dao]

A Data Access Object (DAO), is a design pattern in object-oriented software design, creating an object that provides an abstract interface to some type of database or other persistence mechanism.

A data access object (DAO) is an object that provides an abstract interface to some type of database or persistence mechanism, providing some specific operations without exposing details of the database. It provides a mapping from application calls to the persistence layer.

Source: Wikipedia (retrieved version)

More details: - Core J2EE Patterns - Data Access Object

2621 questions
0
votes
1 answer

Jetpack compose onSuccess() with insert into Room DB

Jetpack compose with room does not perform onSuccess() action, however the data was inserted This is my viewModel call from the screen fun: DIRECTOR_ID = UUID.randomUUID() AGENCY_ID = UUID.randomUUID() viewModel.addDirectorAndAgency( director =…
0
votes
0 answers

App crashing while creating Dao object for room database

My app is crashing and the only thing I know for sure is that the main problem is this line -> val placesDao = (application as HotspotBucketApp).placesDb.placesDao() can any one tell please me why is this happening. private fun getPlaceList() { …
Aditya Jha
  • 11
  • 2
0
votes
0 answers

Can multiple threads call methods from same object from custom made ServiceProvider?

I have one question, I'll explain situation. I have Service which has field DAO. And I am making multithreaded application. Every time I make ClientHandler thread I pass it a new instance of Controller in which I have field Service. My question is…
0
votes
0 answers

Using a List with Pageable in a (custom) Query throws Mixed Parameter Strategies Exception

I would like to understand why my custom query returns either a Mixed Parameter Strategies Exception or a Column... Not Found in ORDER BY... (when removing pageable below). // I need to use this request in order to return screenshots that matches…
newenpoi
  • 1
  • 1
0
votes
0 answers

Transaction across multiple DAOs in JPA

I didn't really found whats the right way to open Transactions across multiple DAOs in JPA/Hibernate. Could this be a way to do it? Or are there better solutions? EntityManager em = createEntityManager(); //from EntityManagerFactory UserDAO userDAO…
user2071938
  • 2,055
  • 6
  • 28
  • 60
0
votes
0 answers

DAO import csv file data

I have an ms Access database and using VBA in this database i and trying to open several csv files and copy data from each one to a new ms Excel workbook using DAO. I am using the connection string as below and i get a Run Tine Error 3044 - which…
Spike
  • 11
  • 1
0
votes
0 answers

Search a string in a multiple rows of my table at once

I use RoomDatabase in android studio, and I have a table of users, something like this: firstname lastname Michael Scott Dwight Schrute What query should I write in the UserDao to search in a couple of rows at once? I want something…
0
votes
1 answer

How do I instantiate a generic DAO class using reflection?

I have been trying to instantiate a generic DAO class. The problem is that I have a Class class. It can be Client or Worker, so I can't specify which class is it. I tried instantiating the DAO class with Class, but the DAO wont work right…
0
votes
0 answers

Java ArchUnit Test: Every DAO method should be just used if a 'using' (transient) parent method is using @Transactional

I am using ArchUnit in order to test the architecture but also to create some coding guidelines. I want to create and test a rule that enables the following scenario: "Each DAO method is accessing the database, thus another parent class or method…
emplo yee
  • 205
  • 2
  • 13
0
votes
1 answer

My Query Quagmire: My node.js program works just fine, except when I try to execute queries, or filtered HTTP requests. Why?

I have been working on the backend of my app. At this point, it can access all data in a data base, and output it. I'm trying to implement some queries, so that the user can filter out the content that is returned. My DAL/DAO, looks like this let…
Juan David
  • 49
  • 5
0
votes
0 answers

How to pass 100% of coverage

@Override public int insertEvent(JobStatusDTO jobStatusDTO) throws AccountUpdateException { LOGGER.info("In insertAccountUpdateEvent- {}", jobStatusDTO); try { jdbcTemplate.execute("INSERT INTO EVENT_LOG…
0
votes
1 answer

How to get specific column from android room db?

I tried to get columns through column names in DAO, but it didn't work. @Query("SELECT :columnName FROM info_table") suspend fun getItem(columnName: String): List I have so many columns so It is not proper approach. @Query("SELECT TIME FROM…
goodies
  • 11
  • 2
0
votes
1 answer

Dao errors in every project with Room

This app is taken from an android course from their site. Once I re-download the same exact code the errors are not present. The code is the same but one has errors. [Errors are shown in the image][1] [1]:…
Dude
  • 3
  • 2
0
votes
3 answers

Avoid duplicate entries in room Database

I am trying to make a function which will check whether this id is already present or not in the database, But it is not working as required.It take the insert value in database. private fun CheckDuplicateId(id:String,donorDao:DonorDao):Boolean{ …
0
votes
1 answer

How to mock jdbcTemplate call of DAO class for Junit test

I have DAO class as below:- // Here I have a class that creates it's own jdbcTemplate using new // jdbcTemplate(dataSource) @Repository public class MyDao { @Autowired @Qualifier("db2JdbcTemplate)" JdbcTemplate jdbcTemplateDB2; public int…
Ranajit
  • 21
  • 1
  • 5