Vinoth Kumar
unread,May 27, 2011, 11:36:09 AM5/27/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to resthub-dev
Hello,
I am using mongoDb for one of my DAO (for the rest I am using MySQL).
I am using Morphia which is a lightweight type-safe library for
mapping Java objects to/from MongoDB. Before switching to mongoDB I
previously used the MySQL Dao and created the service and controller
layers
When I later switched to mongoDb using Morphia I replaced the DAO and
DAOImplementation of GenericJpaResourceDao of RestHub with BasicDAO of
Morphia.
import com.google.code.morphia.dao.BasicDAO;
@Named("poiDao")
public class POIDaoImpl extends BasicDAO<Poi, ObjectId> implements
POIDao {
..........
............
}
public interface POIDao extends DAO<Poi, ObjectId> {
............
.............
}
I am still using the same Model layer from the RestHub generic
resource.
import com.google.code.morphia.annotations.Entity;
@Entity("poi")
public class Poi extends Resource {
...........
...........
...........
}
In the service layer implementation when I try to implement the Poi
and POIDao there was an incompatibility, since the
GenericResourceServiceImpl of Poi extends Poi correctly but the PoiDao
is no longer GenericResourceDao<T> but replaced with DAO<Poi,
ObjectId> of Morphia.
@Named("poiService")
public class POIServiceImpl extends GenericResourceServiceImpl<Poi,
POIDao> implements POIService {
.............
..............
}
public abstract class GenericResourceServiceImpl<T extends Resource, D
extends GenericResourceDao<T>>
***************************************************************************************************************************************
But the real problem is this.
Due to the above mentioned incompatibility I made the following
changes in the POIDao interface.
In the POIDao interface when I included both DAO and
GenericResourceDao like the one given below, but even then there is
incompatibility since both define methods such as delete. Hence the
incompatibility.
public interface POIDao extends DAO<Poi, ObjectId>,
GenericResourceDao<Poi> {
.....
...}
***************************************************************************************************************************************
Kindly help me how to fix this.
Regards,
Vinoth