dao

DAO large query lockup on Win7 multicore

I have a C++ app that uses a Jet database through DAO. Large queries work well up through Vista but lockup under Win7 on a multicore machine. I have tried both jet 3.5 and 4.0. Both fail. I have tried disabling threads in calling prog (my app) - still fails. ...

Calling one DAO from another DAO?

Can this ever make sense? Say I need to fetch an object from the DB which has a relation to another object (represented by a foreign key in the DB, and by a composition in my domain object). If in my first DAO I fetch the data for object 1, then call the dao for object 2, and finally (from within the first DAO, call the setter in objec...

DAO .Execute method fails in Access mde

First off, I'm using Access 2000 and DAO. I have code that executes a simple INSERT INTO query that I call using db.Execute. This code works fine inside an mdb. However, if I compile into an mde then I get error 5 - Invalid procedure call or argument on this line and the record does not get inserted. However, if I change from...

Java webservice: use MVC or DAO+managers

Hello, I'm trying to learn how to develop web-services in java. Now some tutorials (I'm trying to learn how to do it myself without using a framework) use the MVC pattern and expose the class to create a WSDD file etc., other tutorials go for a DAO + managers. Now I haven't been able to find an article discussing the differences (askin...

Getting error while executing dao

Hello friends i am running code given below which contains the setLogTimeEntery function and when this function is executed i am getting "Error : java.sql.SQLException: ORA-00917: missing comma" error and my database is oracle plese any one tell me wht is the problem. public int setLogTimeEntery(Connection con, LogTimeBean ltb) { i...

Question about hibernate-spring-dao

I have a DAO class which I'm using to try select/update/insert with hibernate and Mysql database. I'm writing methods for these now, I already wrote insert like this : public Long save(People transientInstance) { log.debug("Saving People instance"); try { Long id = (Long)getHibernateTemplate().save(transientI...

Should I pass in or encapsulate a connection in a DAO?

Is it better to encapsulate the connection inside a DAO, ie have the DAO create or retrieve the connection and then close, or is better to pass the connection into the DAO and handle the details in code external to the DAO? Follow-up: How do you mange closing connections if you encapsulate the connection inside the DAO? ...

DAO, Spring and Hibernate

Correct me if anything is wrong. Now when we use Spring DAO for ORM templates, when we use @Transactional attribute, we do not have control over the transaction and/or session when the method is called externally, not within the method. Lazy loading saves resources - less queries to the db, less memory to keep all the collections fetch...

ORM model and DAO in my particular case

I have the DB structure as follows: table STUDENT (say, id, surname, etc) table STUDENT_PROPERTIES (say, name_of_the_property:char, value_of_the_property:char, student_id:FK) table COURSE (id, name, statusofcourse_id) table STATUSOFSOMETHING (id, name_of_status:char ('active','inactive','suspended' etc)) table STUDENT_COURSE (studen...

How to test a DAO with JPA implementation ?

Hi I came from the Spring camp , I don't want to use Spring , and am migrating to JavaEE6 , But I have problem testing DAO + JPA , here is my simplified sample : public interface PersonDao { public Person get(long id); } This is a very basic DAO , because I came from Spring , I believe DAO still has its value , so I decided to add...

Using Static methods or none static methods in Dao Class ?

Hi I generate Dao classes for some DB operations in this manner making methods of Dao class as static or none static is better? Using sample dao class below ,İf more than one client got to use the AddSampleItem method in same time?how this may result? public class SampleDao { static DataAcessor dataAcessor public static void ...

Designing DAOs for data sources other than a database

Hi, Until now I've been used to using DAOs to retrieve information from databases. Other sources of data are possible though and I'm wondering if and how the pattern could be applied in general. For example, I'm now working on an application that fetches XML on the web. The XML file could be considered as a data source and the actual f...

Jmock mock DAO object

Hi all, I wrote a method that retrieves certain list of strings, given a correct string key. Now when I create a list(the one to be retrieved by method descibed in previous sentence) and create test I can easily get results and test passes successfully. Now on the other hand if I save the content of this list to database in 2 columns, ...

Hibernate or JPA or JDBC or ???

I am developing a Java Desktop Application but have some confusions in choosing a technology for my persistence layer. Till now, I have been using JDBC for DB operations. Now, Recently I learnt Hibernate and JPA but still I am a novice on these technologies. Now my question is What to use for my Java Desktop Application from the fol...

Getting fewer columns with hibernate

I have a table with 11 columns, but I need to get only 2 of them in my application, I'm using spring/hibernate/DAO combination. For now I have a domain class which includes all 11 fields, and mapping file which maps all 11 columns in table. How do I use get just 2 of them not all? ...

What’s the strategy to recover data during DAO unit test?

When I test DAO module in JUnit, an obvious problem is: how to recover testing data in database? For instance, a record should be deleted in both test methods testA() and testB(), that means precondition of both test methods need an existing record to be deleted. Then my strategy is inserting the record in setUp() method to recover data....

Hibernate GenericDAO for parent/child relationships and DAO/DTO patterns

Hi, I'm looking for a Generic DAO implementation in Hibernate that includes parent/child relationship management (adding, removing, getting children, setting parents, etc). Actually the most used generic DAO on the web is the one I found on jboss.org. And also, i was looking for some DAO/DTO sample implementations and design pattern...

Working with hibernate/DAO problems

Hello everyone here is my DAO class : public class UsersDAO extends HibernateDaoSupport { private static final Log log = LogFactory.getLog(UsersDAO.class); protected void initDao() { //do nothing } public void save(User transientInstance) { log.debug("saving Users instance"); try { ...

Avoid having a huge collection of ids by calling a DAO.getAll()

Instead of returning a List<Long> of ids when calling PersonDao.getAll() we wanted not to have an entire collection of ids in memory. Seems like returning a org.springframework.jdbc.support.rowset.SqlRowSet and iterate over this rowset would not hold every object in memory. The only problem here is i cannot cast this row to my entity. ...

How is an SOA architecture really supposed to be implemented?

My project is converting a legacy fat-client desktop application into the web. The database is not changing as a result. Consequently, we are being forced to call external web services to access data in our own database. Couple this with the fact that some parts of our application are allowed to access the database directly through DA...