Generic Hibernate dao

Hi, I have been working with a generic HibernateDao to which I pass the entity type through a constructor parameter, and it works perfectly. I ran into a [SpringSource team blog|http://blog.springsource.com/2006/09/29/exploiting-generics-metadata/] by Rob Harrop that explained how to determine the actual type of the parameter at runtime. I also found a [page on the Hibernate documentation|http://www.hibernate.org/328.html] that explained the same concept. I used Robs version for my own GenericDao:
public class HibernateDao<E> implements GenericDao<E> {
    private SessionFactory sessionFactory;
    private Class<E> entityClass;
    public HibernateDao() {
        entityClass = extractTypeParameter(getClass());
   // All sorts of DAO  methods
   private Class extractTypeParameter(Class<? extends GenericDao> genericDaoType) {
        Type[] genericInterfaces = genericDaoType.getGenericInterfaces();
        // find the generic interface declaration for GenericDao<E>
        ParameterizedType genericInterface = null;
        for (Type t : genericInterfaces) {
            if (t instanceof ParameterizedType) {
                ParameterizedType pt = (ParameterizedType)t;
                if (GenericDao.class.equals(pt.getRawType())) {
                    genericInterface = pt;
                    break;
        if(genericInterface == null) {
            throw new IllegalArgumentException("Type '" + genericDaoType
               + "' does not implement GenericDao<E>.");
        return (Class)genericInterface.getActualTypeArguments()[0];
}and ran into a ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class for the line with the return statement. It seems they both implement the Type interface, but they are no subclasses of each other. These articles must have been read and tried by numerous people and I found other sites that implement the same thing, what am I doing wrong to get this exception?
Edited by: Peetzore on 9-feb-2009 14:45

OK, I've also encountered the same problem, investigated it and finally got into solution.
The trick with getActualTypeArguments() being of type Class and not TypeVariable works when you instantiate the type argument statically, not dynamically.
Statically here means:
class SomeEntityHibernateDAO extends HibernateDAO<SomeEntity> { ... }
SomeEntityHibernateDAO dao = new SomeEntityHibernateDAO();and dynamically:
HibernateDAO<SomeEntity> dao = new HibernateDAO<SomeEntity>();In the first case, the "actual type argument" (like in getActualTypeArgument) of E in your code gets bound to Class<SomeEntity>, in the second - to TypeVariable.
It may be the case, that the desired Class object is further extractable from the TypeVariable (look at its methods), but simply what you may want is to define separate classes for all entities (statically binding the type parameter) and use these instead of generic declarations.
Hope it helps.
Cheers,
Jarek

Similar Messages

  • Hibernate, DAO pattern and tree hierarchy

    Hi all,
    I use Hibernate for a short period of time and now I'm facing a complex problem . I try figure it out what is the best practice for the following scenario:
    I have the following classes: Department, Team, Position, all of them inherited from a Entity class even there is almost no difference between them. But I wanted different classes for different entities.
    I try to create a tree hierachy, each object is with all others in a bidirectional one-to-many relationship. For example a Department can have Teams and Positions as children and a Position can have Departments and Teams as children.
    I created the mapping files and I don't know how to create all necessary methods without duplicating the code.
    Questions:
    1. Do I need a DAO pattern implemented for this design?
    2. Can you recomend some documentation or ideas that will help me find out what is the best approach in this case?
    Thanks

    Write the DAO for the class that is the root of the tree. Sounds like it should be DepartmentDao.
    I don't know of much better documentation than the Hibernate docs. Check their forum, too.
    %

  • DAO and Domain Object

    hi,
    Normally when i want to persist a domain object like Customer object to a database, my statements will be below,
    // code from my facade
    Customer cust = new Customer();
    cust.setFirstName("myname");
    cust.setLastName("mylastname");
    // set another attributes
    cust.create();
    with this code i have a CustomerPersistence object to handler for create this customer record to a database. Now j2ee have a DAO pattern. So my question is,
    1.where is a domain object within DAO pattern? --> because of we can reused domain object.
    2.DTO is Domain Object, isn't it?
    3.when i look at some articles about DAO, many of it will present in this way
    facade -->create DTO --> call DAO (plus something about factory pattern)
    i never see something like this
    facade --> domain object --> dao
    any suggestion?
    anurakth
    sorry for my english!!

    Hi,
    I am a bit confused about implementation of the domain model and I wondered if you could help. My main concern is that I am introducing too many layers and data holders into the mix. Here is what I am thinking.
    DTO - used to carry data between the presentation and the services layer
    Service Class - coordinates the calling of domain objects
    Domain Object - models a domain entity, service layer logic specific to this object is to be implemented here.
    Data Object - an exact representation of a database table. many to many relationship between domain object and data object.
    Hibernate DAO Class - has no properties, just methods used for read and writing the object to the database. It is passed in the Data Object for persistence. Is it wrong that the DAO contains no properties?
    Perhaps the domain object will contain each data object it is comprised of. I was originally going to keep calls to DAOs in the Services class (as recommended in http://jroller.com/page/egervari/20050109#how_to_change_services_logic ) but I am thinking that each domain object could expose a save method, and that method would co-ordinate persisting itself to the various tables it is derived from.
    Does this sound resonable? I have trouble finding a pattern on the net that clealy defines the Domain Model. I was tempted to map Domain Objects directly to database tables, and simply persist the Domain Object, but this 1-1 relationship may not always hold true.
    Thanks.

  • Need help with Hibernate project

    Can anyone help me with the errors I'm getting with my code? Here is what I have.
    package com.training.hibernate.client; import com.training.hibernate.dao.BookDAO; import com.training.hibernate.dao.PublisherDAO; import com.training.hibernate.domain.Book; import com.training.hibernate.domain.Publisher; public class BookPublisherClient { public static void main(String[] args) { // Create publishers Publisher publisher1 = new Publisher(); publisher1.setId(1); publisher1.setPublisher("Best Publishers"); PublisherDAO.createPublisher(publisher1); Publisher publisher2 = new Publisher(); publisher2.setId(2); publisher2.setPublisher("Smith and Sons Publishing"); PublisherDAO.createPublisher(publisher2); Publisher publisher3 = new Publisher(); publisher3.setId(3); publisher3.setPublisher("Really Good Publishers"); PublisherDAO.createPublisher(publisher3); // Create books Book book1 = new Book(); book1.setId(1); book1.setPublisher("Best Publishers"); book1.setTitle("Learning J2EE"); book1.setAuthor("John Smith"); BookDAO.createBook(book1); Book book2 = new Book(); book2.setId(2); book2.setPublisher("Best Publishers"); book2.setTitle("J2EE Made Easy"); book2.setAuthor("Tom Johnson"); BookDAO.createBook(book2); Book book3 = new Book(); book3.setId(3); book3.setPublisher("Smith and Sons Publishing"); book3.setTitle("J2EE Tutorial"); book3.setAuthor("Jim Van Buren"); BookDAO.createBook(book3); Book book4 = new Book(); book4.setId(4); book4.setPublisher("Smith and Sons Publishing"); book4.setTitle("Java for C++ Programmers"); book4.setAuthor("James McKinley"); BookDAO.createBook(book4); Book book5 = new Book(); book5.setId(5); book5.setPublisher("Smith and Sons Publishing"); book5.setTitle("J2EE"); book5.setAuthor("Tom Adams"); BookDAO.createBook(book5); Book book6 = new Book(); book6.setId(6); book6.setPublisher("Really Good Publishers"); book6.setTitle("So You Wanna Be A Java Programmer!"); book6.setAuthor("William Wilson"); BookDAO.createBook(book6); Book book7 = new Book(); book7.setId(7); book7.setPublisher("Really Good Publishers"); book7.setTitle("Learning J2EE"); book7.setAuthor("John Smith"); BookDAO.createBook(book7); // Test PublisherDAO's ability to list a publisher's books PublisherDAO.listBooksByPublisher("Smith and Sons Publishing"); // Test Book DAO's ability to list a book's publisher BookDAO.getPublisherById(6); } }
    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" > <hibernate-mapping package=""> <class name="com.training.hibernate.domain.Publisher" table="publisher"> <id name="id"> <generator class="assigned" /> </id> <property name="message" type="string" column="publisher"></property> <property name="bookSet" column="bookSet"></property> <many-to-one name="book" column="bookId" update="false" /> <set name="books" table="book" inverse="true" lazy="true" order-by="bookId"> <key column="publisher" /> <one-to-many class="Book" /> </set> </class> </hibernate-mapping>
    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" > <hibernate-mapping package=""> <class name="com.training.hibernate.domain.Book" table="book"> <id name="bookId"> <generator class="assigned" /> </id> <property name="message" type="string" column="publisher"></property> <property name="message" type="string" column="title"></property> <property name="message" type="string" column="author"></property> </class> </hibernate-mapping>
    Exception in thread "main" org.hibernate.InvalidMappingException: Could not parse mapping document from resource publisher.hbm.xml at org.hibernate.cfg.Configuration.addResource(Configuration.java:616) at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1635) at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1603) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1582) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1556) at org.hibernate.cfg.Configuration.configure(Configuration.java:1476) at org.hibernate.cfg.Configuration.configure(Configuration.java:1462) at com.training.hibernate.dao.PublisherDAO.createPublisher(PublisherDAO.java:20) at com.training.hibernate.client.BookPublisherClient.main(BookPublisherClient.java:15) Caused by: org.hibernate.PropertyNotFoundException: field [bookSet] not found on com.training.hibernate.domain.Publisher at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:145) at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:137) at org.hibernate.property.DirectPropertyAccessor.getGetter(DirectPropertyAccessor.java:160) at org.hibernate.util.ReflectHelper.getter(ReflectHelper.java:241) at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:229) at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:302) at org.hibernate.cfg.HbmBinder.createProperty(HbmBinder.java:2193) at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2170) at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2060) at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:381) at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:295) at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:166) at org.hibernate.cfg.Configuration.add(Configuration.java:716) at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:551) at org.hibernate.cfg.Configuration.addResource(Configuration.java:613) ... 8 more

    I've made some changes to my Publisher.java, which I'd forgotten to post here anyway, but which I do now. Below is the new exception list I'm getting. Can anyone help me?
    package com.training.hibernate.domain;
    import java.util.Set;
    public class Publisher {
         private int id;
         private String publisher;
         private Set<Book> bookSet;
         public int getId() {
              return id;
         public void setId(int id) {
              this.id = id;
         public String getPublisher() {
              return publisher;
         public void setPublisher(String publisher) {
              this.publisher = publisher;
         public Set<Book> getBooks() {
              return bookSet;
         public void setBooks(Set<Book> bookSet) {
              this.bookSet = bookSet;
    Exception in thread "main" org.hibernate.InvalidMappingException: Could not parse mapping document from resource publisher.hbm.xml
         at org.hibernate.cfg.Configuration.addResource(Configuration.java:616)
         at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1635)
         at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1603)
         at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1582)
         at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1556)
         at org.hibernate.cfg.Configuration.configure(Configuration.java:1476)
         at org.hibernate.cfg.Configuration.configure(Configuration.java:1462)
         at com.training.hibernate.dao.PublisherDAO.createPublisher(PublisherDAO.java:20)
         at com.training.hibernate.client.BookPublisherClient.main(BookPublisherClient.java:15)
    Caused by: org.hibernate.PropertyNotFoundException: field [book] not found on com.training.hibernate.domain.Publisher
         at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:145)
         at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:137)
         at org.hibernate.property.DirectPropertyAccessor.getGetter(DirectPropertyAccessor.java:160)
         at org.hibernate.util.ReflectHelper.getter(ReflectHelper.java:241)
         at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:229)
         at org.hibernate.mapping.ToOne.setTypeUsingReflection(ToOne.java:81)
         at org.hibernate.cfg.HbmBinder.createProperty(HbmBinder.java:2193)
         at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2170)
         at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2060)
         at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:381)
         at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:295)
         at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:166)
         at org.hibernate.cfg.Configuration.add(Configuration.java:716)
         at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:551)
         at org.hibernate.cfg.Configuration.addResource(Configuration.java:613)
         ... 8 more

  • Jdevloper11g+weblogic integrated server  -Hibernate jars not loading

    I'm trying to call Session bean from manged bean.Session bean internall calls Hibernate DAO.
    I did project setup and everything looks OK.But keep getting Hibernate calsses not found error when i try to run jsp page.
    Please advise me..how to load hibernate jars into integrated weblogic.
    My environment
    Jdev11g
    Oracle10g
    Ejb3
    Hibernate3
    JSF
    Thanks
    Kalee

    When you define the library settings for Hibernate, don't use "Include Jar" but create a new library, eg Project scope, and check the Default Deployment check box.
    --olaf                                                                                                                                                                                                                                                                                                                                                           

  • Hibernate + java + SQL server2000 + OC4j server

    hi java / hibernate Experts,
    I am new in using hibernate3 version for
    executing stored procdure in SQLserver 2000.
    I have started working on this by learining from www.hibernate.org.
    I am getting below error and could not rectify from few days.
    Could any one add your comments for Stored procedure execution for SQL server 2000.
    Where can i get information regarding execution of Stored procedures for SQL server in hibernat3
    XML Mapping for Calling Stored Procedure
    <sql-query name="sp_test1_SP" callable="true">
    <return alias="metrics" class="com.utc.pw.acs.hibernate.model.Usermetrics">
    <return-property name="firstlogin" column="FIRSTLOGIN"/>
    <return-property name="lastactive" column="LASTACTIVE"/>
    </return>
    { ? = call sp_test1() }
    </sql-query>
    SQL Server Stored Procedure
    SET QUOTED_IDENTIFIER OFF
    GO
    SET ANSI_NULLS ON
    GO
    ALTER PROC sp_test1 @sowcursor cursor varying OUT AS
    DECLARE s CURSOR
    LOCAL
    FOR SELECT * FROM acs.dbo.Usermetrics
    OPEN s
    SET @sowcursor=s
    RETURN(0)
    GO
    SET QUOTED_IDENTIFIER OFF
    GO
    SET ANSI_NULLS ON
    GO
    Calling procedure in DAO
    hbSession = (Session)CSessionFactory.getSession();
    SQLQuery query = (SQLQuery)hbSession.getNamedQuery("sp_test1_SP");List results = query.list();
    Exception:
    06/03/21 18:00:58 Closing hibernate Session of this thread.
    org.hibernate.exception.SQLGrammarException: could not execute query
    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.j
    ava:65)
    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelp
    er.java:43)
    at org.hibernate.loader.Loader.doList(Loader.java:2153)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
    at org.hibernate.loader.Loader.list(Loader.java:2024)
    at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:117)
    at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1607)
    at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:
    121)
    at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:169)
    at com.utc.pw.acs.hibernate.dao.CMainMenuDAO.getMetrics(CMainMenuDAO.jav
    a:76)
    at com.utc.pw.acs.action.CMainMenuAction.loadMainMenu(CMainMenuAction.ja
    va:203)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchActio
    n.java:274)
    at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:
    194)
    at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
    tProcessor.java:419)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
    va:224)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:119
    6)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletReque
    stDispatcher.java:765)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(Ser
    vletRequestDispatcher.java:317)
    at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequ
    estDispatcher.java:220)
    at com.evermind.server.http.GetParametersRequestDispatcher.forward(GetPa
    rametersRequestDispatcher.java:257)
    at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.
    java:1062)
    at org.apache.struts.action.RequestProcessor.processForwardConfig(Reques
    tProcessor.java:386)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
    va:229)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:119
    6)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletReque
    stDispatcher.java:765)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(Ser
    vletRequestDispatcher.java:317)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpReques
    tHandler.java:790)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
    va:270)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
    va:112)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(Relea
    sableResourcePooledExecutor.java:186)
    at java.lang.Thread.run(Thread.java:534)
    Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Inv
    alid parameter binding(s).
    at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.base.BasePreparedStatement.validateParameters(Unkn
    own Source)
    at com.microsoft.jdbc.base.BasePreparedStatement.validateParameters(Unkn
    own Source)
    at com.microsoft.jdbc.base.BasePreparedStatement.preImplExecute(Unknown
    Source)
    at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
    at com.microsoft.jdbc.base.BaseStatement.executeInternal(Unknown Source)
    at com.microsoft.jdbc.base.BasePreparedStatement.execute(Unknown Source)
    at org.hibernate.dialect.SybaseDialect.getResultSet(SybaseDialect.java:1
    49)
    at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:
    146)
    at org.hibernate.loader.Loader.getResultSet(Loader.java:1666)
    at org.hibernate.loader.Loader.doQuery(Loader.java:662)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Lo
    ader.java:224)
    at org.hibernate.loader.Loader.doList(Loader.java:2150)
    ... 38 more

    Hello,
    I think that you do not need ? = in your xxx.hbm.xml file.
    === Orignal XML
    XML Mapping for Calling Stored Procedure
    <sql-query name="sp_test1_SP" callable="true">
    <return alias="metrics" class="com.utc.pw.acs.hibernate.model.Usermetrics">
    <return-property name="firstlogin" column="FIRSTLOGIN"/>
    <return-property name="lastactive" column="LASTACTIVE"/>
    </return>
    { ? = call sp_test1() }
    </sql-query>
    ==== Change the last call store procedure
    { call sp_test1() }

  • How to enable multiple access to a web cam?

    Hi... I am using JMF to develop an online monitoring web page with Java Applet.
    However, as i tried it just now, when one browser is rendering that page, others can not even lauch the web cam.
    I am using Logitech QuickCam. Is it because of the web cam is possessed by one application, and others have to wait? Or the client should also install JMF in order to view the page successfully?
    Can anyone please tell me?
    Thanks in advace.

    Let me get this straight. You have a web application that uses spring framework and hibernate to access the database. You want the user to be able to select the database that he wants to access using spring and hibernate.
    Hopefully you are using the Spring Framework Hibernate DAO. I know you can have more that one spring application context. You can then trying to load a seperate spring application context for each database. Each application context would have it's own configuration files with the connection parameters for each datasource. You could still use JNDi entries in the web.xml for each datasource.
    Then you would need a service locater so that when a user selected a datasource he would get the application context for that datasource which he would use for the rest of his session.
    I think it is doable. It means a long load time. And you'll need to keep the application contexts as small as possible to conserve resources.

  • How to handle multiple datasources in a web application?

    I have a J2EE Web application with Servlets and Java ServerPages. Beside this I have a in-house developed API for certain services built using Hibernate and Spring with POJO's and some EJB.
    There are 8 databases which will be used by the web application. I have heard that multiple datasources with Spring is hard to design around. Considering that I have no choice not to use Spring or Hibernate as the API's are using it.
    Anyone have a good design spesification for how to handle multiple datasources. The datasource(database) will be chosen by the user in the web application.

    Let me get this straight. You have a web application that uses spring framework and hibernate to access the database. You want the user to be able to select the database that he wants to access using spring and hibernate.
    Hopefully you are using the Spring Framework Hibernate DAO. I know you can have more that one spring application context. You can then trying to load a seperate spring application context for each database. Each application context would have it's own configuration files with the connection parameters for each datasource. You could still use JNDi entries in the web.xml for each datasource.
    Then you would need a service locater so that when a user selected a datasource he would get the application context for that datasource which he would use for the rest of his session.
    I think it is doable. It means a long load time. And you'll need to keep the application contexts as small as possible to conserve resources.

  • Connection refused when connecting SMP 3 to ASE 16

    Hi all,
    We're in the process of setting up an installation of SMP 3.0 with Sybase ASE 16 for one of our clients. The final goal is to run the SAP EHS Safety Issue mobile app.
    When installing SMP 3.0 with Derby database, I'm able to start the system without any problems. However, when I try the installation configuring the Sybase ASE DB, the service gets stuck on a loop while starting up and doesn't react. I cannot stop it manually nor restart it. The only way to stop it is by restarting the system.
    On the Sybase side of things, I can install the ASE without any issues. I have also done all the preliminary steps to create the user and smp3 DB for SMP. I've connected to the DB using this user and I'm able to see that the smp3 DB is created.
    When looking at the logs, I can see an exception with the message: Connection refused. Here's an excerpt:
    2014 07 28 15:01:10#0-500#ERROR#org.jgroups.protocols.SMP_JDBC_PING##anonymous#Timer-2,SAPDSMP-5000-smp3-smpserver:com.sap.mobile.platform.server.online.admin.backendconnections.cluster.ClusterBackends,SAPDSMP-4630###Failed creating JDBC connection for SMP_JDBC_PING java.sql.SQLException: JZ006: Caught IOException: java.net.ConnectException: Connection refused: connect
      at com.sybase.jdbc4.jdbc.SybConnection.getAllExceptions(Unknown Source)
      at com.sybase.jdbc4.jdbc.SybConnection.handleSQLE(Unknown Source)
      at com.sybase.jdbc4.jdbc.SybConnection.tryLogin(Unknown Source)
      at com.sybase.jdbc4.jdbc.SybConnection.handleHAFailover(Unknown Source)
    Any idea what may be causing this issue?
    Kind regards,
    Omar

    I tried using the go.bat to start the server and got the same error. Here's the output:
    Using SMP_BASE:    "D:\SAP\MobilePlatform3\Server"
    Using SMP_HOME:    "D:\SAP\MobilePlatform3\Server"
    Using SMP_OPTS:    " "-Dlog4j.logfiles.path=D:\SAP\MobilePlatform3\Server\log" "
    -Dwicket.configuration=development" "-Dmobiliser.home=D:\SAP\MobilePlatform3\Ser
    ver" "-DMOBILISER_PROTOCOL=http" "-DMOBILISER_HOSTNAME=localhost" "-DMOBILISER_P
    ORT=8080" "-DMOBILISER_HOST=http://localhost:8080" "-Dtracker.defaultHost=localh
    ost" "-Dtracker.defaultPort=8080" "-Dtracker.defaultServlet=/mobiliser" "-Dcom.s
    ap.mobile.platform.server.home=D:\SAP\MobilePlatform3\Server" "-DPREFS_PROTOCOL=
    prefs""
    Using JAVA_HOME:   "D:\SAP\MobilePlatform3\sapjvm_7"
    "Updating SMP3 Server P2 Repository Locations to: D:\SAP\MobilePlatform3\Server/
    p2"
            1 file(s) moved.
            1 file(s) moved.
    "Updating server log name to reflect the hostname"
            1 file(s) moved.
    java version "1.7.0_25"
    Java(TM) SE Runtime Environment (build 7.1.012)
    SAP Java Server VM (build 7.1.012 23.5-b11, Aug  8 2013 23:45:34 - 71_REL - optU
    - windows amd64 - 6 - bas2:201691 (mixed mode))
    D:\SAP\MobilePlatform3\Server>"D:\SAP\MobilePlatform3\sapjvm_7\bin\java.exe" -se
    rver  -XtraceFile=log/vm_@PID_trace.log   "-Dlog4j.logfiles.path=D:\SAP\MobilePl
    atform3\Server\log" "-Dwicket.configuration=development" "-Dmobiliser.home=D:\SA
    P\MobilePlatform3\Server" "-DMOBILISER_PROTOCOL=http" "-DMOBILISER_HOSTNAME=loca
    lhost" "-DMOBILISER_PORT=8080" "-DMOBILISER_HOST=http://localhost:8080" "-Dtrack
    er.defaultHost=localhost" "-Dtracker.defaultPort=8080" "-Dtracker.defaultServlet
    =/mobiliser" "-Dcom.sap.mobile.platform.server.home=D:\SAP\MobilePlatform3\Serve
    r" "-DPREFS_PROTOCOL=prefs" -XX:ErrorFile="D:\SAP\MobilePlatform3\Server\log\err
    or.log" -XX:HeapDumpPath="D:\SAP\MobilePlatform3\Server\log\heap_dump.hprof" "-X
    X:+HeapDumpOnOutOfMemoryError" "-XX:+DisableExplicitGC" "-Xms1024m" "-Xmx2048m"
    "-XX:PermSize=256M" "-XX:MaxPermSize=512M" "-Dosgi.requiredJavaVersion=1.6" "-Du
    seNaming=osgi" "-Dosgi.install.area=." "-Djava.io.tmpdir=./work/tmp" "-Djava.end
    orsed.dirs=lib/endorsed" "-Dorg.eclipse.equinox.simpleconfigurator.exclusiveInst
    allation=false" "-Dcom.sap.core.process=ljs_node" "-Declipse.ignoreApp=true" "-D
    http.proxyHost=" "-Dhttp.proxyPort=" "-Dhttps.proxyHost=" "-Dhttps.proxyPort=" "
    -Dorg.eclipse.net.core.enableProxyService=false" "-Dosgi.noShutdown=true" "-Dosg
    i.framework.activeThreadType=normal" "-Dosgi.embedded.cleanupOnSave=true" "-Dosg
    i.usesLimit=30" "-Djava.awt.headless=true" "-Dtc.active=true" "-Dmail.mime.encod
    eparameters=true" "-Dnet.sf.ehcache.skipUpdateCheck=true" "-Dorg.eclipse.gemini.
    blueprint.extender.internal.boot.ChainActivator.disableBlueprint=true" "-Dcom.sy
    base365.mobiliser.util.tools.springextender.threadpool.size=20" "-Dcom.sybase365
    .mobiliser.util.tools.springextender.shutdown.wait.time=35000" "-Dwicket.configu
    ration=deployment" "-DlicenseAccepted=true" "-Dorg.apache.tomcat.util.buf.UDecod
    er.ALLOW_ENCODED_SLASH=true" "-Dcom.sybase365.mobiliser.framework.service.config
    .MobiliserServiceBeanDefinitionParser.serviceAdviceConfig=audit,security,caller-
    audit,responseCode,traceableRequest,responseCode,filterExternal,sessionManagemen
    t,txn" "-Dcom.sybase365.mobiliser.framework.service.config.MobiliserServiceBeanD
    efinitionParser.internalServiceAdviceConfig=security,responseCode,validation,res
    ponseCode,filterInternal,sessionManagement,txn" "-Dcom.sybase365.mobiliser.frame
    work.service.config.MobiliserInternalServiceBeanDefinitionParser.responseCodeTyp
    e=responseCode" "-Dcom.sybase365.mobiliser.framework.service.config.MobiliserInt
    ernalServiceBeanDefinitionParser.auditType=audit" "-Dcom.sybase365.mobiliser.mon
    ey.persistence.hibernate.dao.transaction.AuthorisationCodeDaoHbnImpl.max=200" "-
    Dcom.sybase365.mobiliser.money.persistence.hibernate.dao.transaction.Authorisati
    onCodeDaoHbnImpl.table=SEQ_AUTH_CODES" "-Dcom.sybase365.mobiliser.money.persiste
    nce.hibernate.dao.transaction.AuthorisationCodeDaoHbnImpl.column=ID_SEQUENCE" "-
    Dcom.sybase365.mobiliser.framework.persistence.hibernate.dialect.useTableBasedSe
    quences=true" "-Dcom.sybase365.mobiliser.framework.persistence.hibernate.dialect
    .useSequenceNameForTableSequences=true" "-Dcom.sybase365.mobiliser.framework.per
    sistence.hibernate.dialect.sequenceTableName=SEQ_TABLE_HILO" "-Dcom.sybase365.mo
    biliser.framework.persistence.hibernate.dialect.sequenceTableSequenceNameColumnN
    ame=STR_SEQUENCE_NAME" "-Dcom.sybase365.mobiliser.framework.persistence.hibernat
    e.dialect.sequenceTableSequenceValueColumnName=ID_SEQUENCE_NEXT_HI_VALUE" "-Dcom
    .sybase365.mobiliser.framework.persistence.jdbc.bonecp.pool.lazy=true" "-Dcom.sa
    p.mobile.platform.server.notifications.baseurl=https://SAPDSMP.corp.local:8081/"
    "-Dcom.sap.mobile.platform.online.proxy.maxresponsesize=-1" "-Dcom.sap.mobile.p
    latform.server.connection.pool.idletimeout=600" "-Dcom.sap.mobile.platform.serve
    r.connection.timeout=60000" "-Dcom.sap.mobile.platform.server.connection.sotimeo
    ut=60000" "-Dcom.sap.mobile.platform.server.enable.statistics=true" "-Dcom.sap.m
    obile.platform.server.maximum.clientlogfiles=10" "-Dcom.sap.mobile.platform.serv
    er.maximum.connectionPoolSize=5000" "-Dcom.sap.mobile.platform.server.maximum.gz
    ipPoolSize=5000" "-Dcom.sybase.security.FactoryRetriever=com.sybase.security.int
    egration.tomcat7.TomcatFactoryRetriever" "-Dcom.sap.mobile.platform.server.gener
    al.status.SMPServerStatusLogging=false" "-DsecretKey=7hZK9zP3cH" "-DsecretKeylen
    gth=128" "-DapnsSocksProxyHost=" "-DapnsSocksProxyPort=" "-Dorg.apache.catalina.
    authenticator.Constants.SSO_SESSION_COOKIE_NAME=X-SMP-SESSIDSSO" "-Dosgi.logfile
    =./log/osgi.log" "-Djava.net.preferIPv4Stack=true" -classpath "D:\SAP\MobilePlat
    form3\Server\lib\org.eclipse.virgo.nano.authentication_3.6.2.RELEASE.jar;D:\SAP\
    MobilePlatform3\Server\lib\org.eclipse.virgo.nano.shutdown_3.6.2.RELEASE.jar;D:\
    SAP\MobilePlatform3\Server\lib\org.eclipse.virgo.util.env_3.6.2.RELEASE.jar;D:\S
    AP\MobilePlatform3\Server\plugins\org.eclipse.equinox.launcher_1.3.0.v20120308-1
    358.jar;D:\SAP\MobilePlatform3\Server\plugins\com.sap.db.jdbc_1.0.31.362930.jar;
    D:\SAP\MobilePlatform3\Server\plugins\jconnect-osgi_7.0.7.ESD5-1.jar;D:\SAP\Mobi
    lePlatform3\Server\plugins\com.sybase365.com.ibm.db2jcc4_9.7.4.jar;D:\SAP\Mobile
    Platform3\Server\plugins\oracle-jdbc-osgi_11.2.0.x_3.0.0.M1.jar;D:\SAP\MobilePla
    tform3\Server\plugins\com.springsource.org.apache.commons.codec_1.4.0.jar;D:\SAP
    \MobilePlatform3\Server\plugins\com.springsource.org.apache.commons.codec_1.6.0.
    jar;D:\SAP\MobilePlatform3\Server\plugins\com.springsource.org.apache.commons.la
    ng_2.5.0.jar" org.eclipse.equinox.launcher.Main -console localhost:2401
    Checking DB...
    Failed to connect to the database on startup:java.sql.SQLException: JZ006: Caugh
    t IOException: java.net.ConnectException: Connection refused: connect
    Checking DB...
    Failed to connect to the database on startup:java.sql.SQLException: JZ006: Caugh
    t IOException: java.net.ConnectException: Connection refused: connect

  • Create an object for just one column in resultset?

    Does it make sense to return a result set of one column into an object that represents that table? It seems like a waste of memory, but maybe I am missing something. Also all generic DOA's I have found don't deal with this situation, so maybe someone can help me with how I think about this problem in my design. Thanks for the thoughts.

    >
    Plan B is to just return a list of Strings instead of a list of "some object". The issue with this is the ease of creating a generic DAO that is easy to program to. Having a DAO for each "table" class seems to be the best practice that is offered out there.
    >
    Well a String IS an object.
    From an architecture perspective you should model a table as a table. So if you have a table of one column you should still model it as a table. A table is a table is a table and you should generally treat it as such until or unless there is a compelling reason not to.
    If you step back from the 'implementation' and refocus on the 'design' and requirements one of those requirements is to identify the sources of data that your application needs. Sounds like that data, at the server level is in a table and the typical interface between an application and a database is via tables. Makes no difference if you need one row or 1000, one column or 30 columns the first focus is on the data source.
    So the interface between an application, in your case a Java app, and a database server will generally involved tables. That means you should probably still use a standard DAO (I assume you mean Data Access Object).
    A generic table DAO would typically have functionality to deal with tables and not just an arbitrary object. It would have getters and setters, functionality to support multiple rows and might even know about columns.
    In good data models tables almost never have just one column. Even a simple lookup table usually has an ID or CODE column and then a value column for the actual data. So if that one column table suddenly becomes two or more columns you will have to refactor your entire architecture to then use a standard DAO.
    That is why the statement you made is true.
    >
    Having a DAO for each "table" class seems to be the best practice that is offered out there.
    >
    Unless you have some real reason not to I suggest you stick with that practice. That will make you code more scaleable and more consistent.
    From an architecture perspective.

  • Solution/Pattern needed for complex buisiness problem

    We currently have a J2EE project built on EJB3 and were hoping to get some help on the design.
    A little background: Our company sells several products for various companies. Each of these companies have different business rules, etc. Initially when we built our application we were unable to connect to the companies directly via Web Services, etc. And since we were not communicating with an external service, our input was the same for all of the suppliers (with minor differences). Now some of the suppliers have given access to them via Web Services. Since some have this type of service and other don't we have various iterations of rules, etc. You can see that the problem can grow very large very quickly with the diversity of external and internal services.
    We would hate to code our business logic with a bunch of if then else (if (company a) then do this; else if ( . . . )). In addition like I said the input also differs per company so we also need to keep that in mind. Like any good application, we want to ensure that the UI is uniform and that the business logic is easily manageable. We need some form of a plug and play type of pattern that would allow us to manage these various services much easily rather than having to go to every business method to update it for the new supplier.
    We were hoping if someone could recommend a solution/pattern that might do us some justice. Thank you in advance.
    What we use now: STRUTS, EJB3 (stateless session beans), JBoss 4.04, Hibernate (DAO pattern), AXIS (web services)

    We would hate to code our business logic with a bunch
    of if then else (if (company a) then do this; else if
    ( . . . )). In addition like I said the input also
    differs per company so we also need to keep that in
    mind. Like any good application, we want to ensure
    that the UI is uniform and that the business logic is
    easily manageable. We need some form of a plug and
    play type of pattern that would allow us to manage
    these various services much easily rather than having
    to go to every business method to update it for the
    new supplier.A java rule engine might be the solution you are looking for. http://java.sun.com/developer/technicalArticles/J2SE/JavaRule.html

  • What is the Best UML tutorial?

    Dear All,
    Can you till me what is the best step by step UML tutorial?
    Thanks in advance
    Abdulhamid Dhaiban
    Java Developer

    valooCK wrote:
    OnBringer wrote:
    you should first go back to the basics, and make sure you understand why you cannot create objects out of abstract classes. since you keep trying to bait duffymo with this, it must be troubling you very much that you don't know. perhaps if you ask your question directly and politely he will be kind enough to explain it to you. why always ask in such roundabout ways? people who ask proper questions usually get a proper answer on these forums. hope this helps!
    why should i ask him questions? if i did, he would have told me about abstract objects, purple fruit, hibernate daos, and references are passed by value.
    dont pretend that you know uml, you shorty crying dum bass, madafakar.ooooh, frustrated :-) maybe making another movie will make you happieri think i will make a movie about him running a public restroom in the village of valoo chickens. installing thoes shorty, fatty and sweety in his words toilets for chickens. yes, its a good idea. watch out, coming soon.Do you never get concerned that maybe you're a little bit obsessed with some people you've never even met? I mean, aside from devoting most of your forum time to stalking a select few with the express purpose of gainsaying whatever they post, you then step away from the forums and devote more time to making movies about these people, and posting it on YouTube. I'd be genuinely concerned if I was you

  • JPA EJB generic DAO

    I am using Jdeveloper 11g R (11.1.2.3) & weblogic 10 G
    In my pages I use JSF & Facelet
    Hi All
      In a new project I am going to use JPA / EJB session beans and ADF Faces
      Also I am going to use similar pattern described in below link for a GenericDAO
      and inject instances of Generic EJB into my business EJBs
        http://www.adam-bien.com/roller/abien/entry/generic_crud_service_aka_dao
        https://blogs.oracle.com/theaquarium/entry/generic_jpa_dao_repository_implementation
      In second link some people mentioned this way is old and over simplified
      Any body have any comment / ideas or similar cases
      I don't want use any external open source libraries
    Thanks
    Mohsen

    I've read that article several months ago and didn't get a chance to try it out. However, I did work with Hibernate quite a bit.
    I believe the author would have us replace this:
    public update(Person person){
    with this:
    public void update(T o) {
    In the first function, its obvious that I'm updating a record in the Person table.
    In the second function, I need to have a list of all the possible table names (such as 'Person') to know which tables have an update function associated with it that I can use with the generic function. For example, some tables may be read-only and dont have an update function.
    Normally, the compiler helps you out by providing a dropdown list of functions an object has that you can choose from.
    Likewise, the compiler will have a dropdown list of all the different arguments (signatures) a function has.
    I dont think the generic function will provide this. As an end-user calling up a Hibernate function that you wrote, I want help from the compiler on what my options are. I don't want to dig into the Hibernate configuration file to determine weather update is allowed for a table or not.
    The downside of not using generics of course, is you have to write a DAO with CRUD functions for each and every table in the database (actually, for every graph, but lets not get into that).
    Also, I don't see an example of how the associations between tables is implemented in generics. For example, one to many relationships, etc. A developer may get bogged down trying to get generics to work for all those possiblies (then again, perhaps not, since I didn't try it).
    By the way, I don't see anything about generic DAO on the internet younger than 2 years old so I suspect it hasn't caught on.

  • JSF calls DAO layer based on  JPA/Hibernate throws NPE

    I'm new in JSF and Hibernate;
    I'm using Hibernate as JPA provider, the dataaccess is tied to DAO layer; when my JSF controller(UserController) calls the getUsers() of my DAO layer
    (Glassfish is the app Server I use)
    NullpointerException is thrown, I assume it's because instance of BasicDAO is initialized, where do I have to instantiate BasicDAO
    here is my code :
    public class BasicDAO {      
    @PersistenceUnit(unitName = "test5PU")
    private EntityManager entityManager;
    public void setEntityManager(EntityManager entityManager)
    {        this.entityManager = entityManager;    }
    public List getUsers() {       
    Query query = entityManager.createNamedQuery("User.findAllUsers");
    return query.getResultList();
    public User findUser(String id) {       
    try{
    Query q = entityManager.createNamedQuery("User.findByIdUser");
    User o = (User)q.getSingleResult();
    return o;
    } finally {
    entityManager.close();
    public class UserController {
    /** Creates a new instance of UserController */
    public UserController() {      
    private DataModel model;
    private BasicDAO basicDAO;
    public DataModel getUsers() {            
    return new ListDataModel(basicDAO.getUsers());
    public void setBasicDAO(BasicDAO basicDAO) {     
    this.basicDAO = basicDAO;
    public BasicDAO getBasicDAO() {           
    return this.basicDAO;
    public User findUser(String id) {
    return basicDAO.findUser(id);
    List.jsp :
    <h:dataTable value='#{user.users}' var='item' border="1" cellpadding="2" cellspacing="0">
    <h:column>
    <f:facet name="header">
    <h:outputText value="IdUser"/>
    </f:facet>
    <h:outputText value="#{item.idUser}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Password"/>
    </f:facet>
    <h:outputText value="#{item.password}"/>
    </h:column>
    </h:dataTable>

    in fact, i did some tests, and the reason why the NPE happens revealed to be caused by the call to
    this.emf = Persistence.createEntityManagerFactory(persistenceUnitName, emfProperties);
    which returns NULL value, and later when emf is accessed to create entitymanager NullPointerException is thrown.
    I think there is a configuration probem some where, except in persistence.xml file. my persistence.xml content is :
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    <persistence-unit name="test9PU" transaction-type="JTA">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta-data-source>JeeCertDB</jta-data-source>
    <class>persistence.user.User</class>
    <properties>
    <property name="hibernate.jdbc.driver"
    value="com.mysql.jdbc.Driver" />
    <property name="hibernate.jdbc.url"
    value="jdbc:mysql://localhost:3306/JeeCertDB" />
    <property name="hibernate.jdbc.user" value="root" />
    <property name="hibernate.jdbc.password" value="belly" />
    <property name="hibernate.logging.level" value="INFO" />
    </properties>
    </persistence-unit>
    </persistence>
    Message was edited by:
    S_screen

  • A design question related to generic dao pattern

    I follow this link https://www.hibernate.org/328.html to design my DAO layer using jpa/ hibernate. And basically it works ok. However, I encounter a dilemma regarding to persistence relation between domain objects.
    My classes include
    User <--(many to many)--> Group
    Tables are USERS, USERS_GROUPS, GROUPS
    In User class, I have properties
         @JoinTable(name="USERS_GROUPS",
              joinColumns=
              @JoinColumn(name="USER_ID"),
              inverseJoinColumns=
              @JoinColumn(name="GROUP_ID")
         private List<Group> groups = new ArrayList<Group>();
         public User(String id, String account, String name, String password){
              this.id = id;
              this.account = account;
              this.name = name;
              this.password = password;
         public List<Group> getGroups(){
              return this.groups;
         public void setGroups(List<Group> groups){
              this.groups = groups;
         }In Group class,
         @ManyToMany(mappedBy="groups",fetch=FetchType.EAGER)
         private List<User> users;  
         public Group(String id, GroupName name){
              this.id = id;
              this.name = name;
         public List<User> getUsers(){
              return this.users;
         public void setUsers(List<User> users){
              this.users = users;
    ...Now in the database (mysql), I have already had two groups existing. They are
    mysql> select * from GROUPS;
    +----+------+
    | ID | NAME |
    +----+------+
    | 1  | Root |
    | 2  | User |
    +----+------+and in the table USERS_GROUPS
    mysql> select * from USERS_GROUPS;
    +--------------------------------------+----------------+
    | USER_ID                               | GROUP_ID |
    +--------------------------------------+----------------+
    | 1                                               | 1                 |
    | 1                                               | 2                 |
    +--------------------------------------+----------------+When I want to create a new user object and assig user object with an existing GROUP (e.g. GroupName.User)
    At the moment the way how I implement it is done in the DAO layer (e.g. UserDaoImpl). (But what I want is to get this procedure done in the domain object layer i.e. User class, not DAO layer. )
    steps:
    1.) search the GROUP table (entityManager.cerateQuery(" from Group").getReulstList())
    So it will return a list of all groups in GROUPS table.
    2.) then check if the group (e.g GroupName.User) I want to assign to the User object existing in the GROUP table or not.
    3.) if not existing, create a new Group and add it to a list; then User.setGroups(newList);
    or
    if the group (to be assigned to User class) already exists, use the group retrieved from the GROUP table and assign this group to the User class (e.g. groupList.add(groupFoundInGroupTable) User.setGroups(groupList))
    However, what I want to do is to encapsulate this procedure into User calss. So that in DAO class whilst performing function createUser(), it would only need to do
    User user = new User(....);
    user.addGroup(GroupName.User); // GroupName is an enum in which it contains two values - Root, User
    entityManager.merge(user);Unfortunately, because I need to obtaining Group collections from GROUP table first by using entityManager, which does not exist in the domain object (e.g. User class). So this road looks like blocked.
    I am thinking about this issue, but at the moment there is no better solution popped upon my head.
    Is there any chance that this procedure can be done more elegantly?
    I appreciate any suggestion.
    Edited by: shogun1234 on Oct 10, 2009 7:25 PM

    You should be able to link your objects using methods in your entities to create an object graph.
    When you save your user the associated objects will also be persisted based on the cascade types that you have specified on the relationships between the entities.

Maybe you are looking for

  • How to set Header variables through Jsp

    Hi, Can anybody help me with the code. I need to send user id in http header variable from jsp to a third party tool, which will read user id from the http header. i am tryng to test if ui can set the variable using th efollowing code <%response.addH

  • Problem with query 0SD_C03_Q004 : Incoming orders

    Hello, I have installed the Best Practices for BI 7 and when I run the query 0SD_C03_Q004 without filter, I have the following message 'No Applicable Data Found' . With the transaction LISTCUBE I can see the data for the cube 0SD_C03. Do you have any

  • Where can I purchase a 60gb Vision M, that will also allow me to purchase an extended warran

    I was looking at b&h b/c I li've in NY but I don't think they sell extended warranties? I wanted to purchase in person somewhere rather than online and Circuit City and Best Buy don't carry the 60gb versions?

  • Quicktime preview in mavericks

    Is there any way of getting back QT previews in Mavericks, with out shelling out £199 on Final Cut X? Seams mad Apple have 'broken' their own format and forced you to purchase a £199 program to get the functionality back. Just paid £2700 for a mac bo

  • Error while Uploading File using BLOB

    Hi All, I am trying to upload file into Database using simple JHeadstart generated screen for a table with a column having BLOB attribute. Wile inserting, I get this error message. JBO-25009: Cannot create an object of type:oracle.jbo.domain.BlobDoma