dao

Why use an MVC framework when Servlets, JSPs and a lightweight DAO layer will work?

I'm finding it difficult to embrace a Java MVC framework, when it looks as if Servlets, JSPs and a lightweight DAO will do just about everything you need it to do in order to decouple the controllers/views/models. For PHP I can see the necessity since there are no built in constructs like servlets, but do Java MVC frameworks really give ...

data cannot preview after unload

why my data not preview back after i unload back form. I use vb6 DAO ...

DAO, Spring, Hibernate, Jboss

How exactly are these 4 components related, any good explanations someone can offer or links or whatever useful. ...

How do you create a DAO class for Seam / JPA (hibernate)?

Hi, I'm learning Seam and JPA/Hibernate and while I could find some examples on how to build a DAO class with Hibernate I'm a bit confused on how to do the same thing with Seam (or even if that is at all necessary). I do know that seam manages the transactions using its conversations so I don't (?) have to worry about committing / roll...

How to create a decimal field in MsAccess using DAO?

I need to create a decimal field in MsAccess 2003 through DAO. How do I do that? Other fields I can create using following codesnippet, but not decimal. How do I set type, precision and scale? NOTE : a decimals datatype = 20, but setting a datatype to 20 results in invalid data type Dim db As DAO.Database Dim tbl As TableDef Dim f...

Transaction between several DAO layers ?

As shown below, I am accessing a Service layer method inside of another DAO. (Every DAO in the system is implemented using HibernateDAOSupport class) I wanted to rollback the transaction when #1 or #2 (commented in the following code) is failed. But when #2 throws an exception, #1 does not get rolled back and I can see the entries in th...

What is the name of the violating unique index constraint in dao / ms-access

hello everyone I am trying to insert a record into a table with DAO (within MS-Access) and doing so, I receive an Error 3022 (which indicates that a unique index is violated). The error is correct since in fact the tried-to-insert record has a value which is already found in the table. Now, I'd like to find out the name of the violate...

Java - DAO Layer or Plugin

Hi, I work on the JBJF Project on SourceForge and we want to improve on the Database Access for this framework. Currently, it's semi-flexible, but the access is done at the Task level. We'd like to setup a simple Interface of some kind that's generic in nature and can host the database access to/from JBJF. Thus, Framework classes don...

Is it possible to create a check constraint in access and/or DAO?

Hello I am trying to create a check constraint on an access (jet?) table. So, I open the .mdb file with access, go into queries->create query in design view, type esc, then menu->view->query and finally type create table X ( a number, check (a > 20) ) but access thinks that I have a "syntax error in field definition". However, I ...

how to integration test a DAO built with spring + iBatis

I asked a question, title of which might have been misleading so I'm going to try to ask the question again with much detailed stuff. (i know question seems long but please bear with me) What I'm trying to do: I simply want to write a test case for my DAO and make it work. I know my DAO's work fine inside the container (app server) but...

Pros and Cons of the use of DAO pattern

As I mention, I'm interested to know what do you (as experienced developers) thinks about the use of DAO pattern, specifically within a Web Application. If possible what advantages have you found, or consequences of it use. Thanks. ...

Using Linq-to-SQL entities in your BLL or UI?

I had a client ask for advice building a simple WPF LOB application the other day. They basically want a CRUD application for a database, with main purpose being as a WPF training project. I also showed them Linq To SQL and they were impressed. I then explained its probably not a good idea to use that L2S entities directly from their B...

Can I do this Generic thing?

Hi there: It seems I'm missing something with Java Generics because something I think is simple, it appears to me that can´t be done. Maybe you can help... This is the scenario: I'm coding a generic abstract DAO with simple CRUD operation so every specific DAO of my application can have it for free: public abstract DefaultDAO<T,V> { ...

DAO Best practices : Querying Parent / Children

Hi Given you have a domain model with a simple parent / child relationship, and each entity has it's own associated DAO, eg: Author AuthorDAO Book BookDAO If I want to add a DAO method for retrieving the books by a specific author, what's the best place for it? class AuthorDAO { List<Book> getBooks(Author author); } or class ...

DAO, ORM and Queries

There is a need to update one field to the same value in a heap of records. Using the DAO/ORM structure, I would retrieve each parent object, loop through each child object, update it's field, and then save it. It would be faster to just write the SQL: update table set field = value where criteria = specified. How do I fit these things...

DAO/Repository/NHibernate And Handling Edge DB Cases

One thing that keeps stumping me, and I do not see much mention of it in books/blogs, is how to handle DB operations in a system that really don't fall under the jurisdiction of DAOs or Repositories. I like using the approach of generic DAOs/Repositories to handle common DB operations, but what about dealing with things that aren't entit...

JPA @VERSION how to use it?

@Entity public class Person { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long id; private int salary; @Version private long version; // ...getters and setters } may i know is there required to create set/get for "version" ? in my code ,when persist (saveorupdate) this entity with hiber...

org.hibernate.HibernateException: No session currently bound to execution context

I'm trying to integrate Spring Security with Hibernate. I'm new to both technologies so I'm almost certainly taking too many steps at once here, but I'm at the point where I want to authenticate a user from the database. I think this is certainly more a Hibernate problem that a Spring Security one but I mention it to give some context. ...

Using JSF, JPA and DAO. Without Spring?

Hi, till now i still worked with JSF and JPA without DAOs. Now i'd like to use DAOs. But how can i initialize the EntityManager in the DAO-Classes? public class AdresseHome { @PersistenceContext private EntityManager entityManager; public void persist(Adresse transientInstance) { log.debug("persisting Adresse inst...

How are Data Access Objects usually designed ?

How are DAOs usually designed for the typical business application ? Does one class or pattern dialogue with the data source or do you simply have a separate DAO for each Entity ? ...