Zum Hauptinhalt gehen

Design & architecture - dynamic customized use cases

Kommentare

9 Kommentare

  • Zendesk API User
    Author: Peter_Jodeleit - 7/14/2010 16:36

    With which type of entities do you want to work with? de.espirit.firstspirit.access.store.pagestore.Page, de.espirit.firstspirit.access.store.pagestore.Section, ...? Or de.espirit.or.schema.Entity?

    I think the latter, since you are talking about 'tables'. Please keep in mind that FS has a temporal aspect in its database tables and that tools like Hibernate and JPA do not support this aspect.

    0
  • Zendesk API User
    Author: bohm - 7/15/2010 8:29

    Hi Marius,

    I talked to our development team and basically our answer is:

    We offer a way to access database content via our OR API. This API includes commit and rollback-functionality, so basic transaction mechanisms are available.

    By using this API it is ensured that versioning and revision information is stored correctiy in the database.

    At present we discourage the use of frameworks such as spring or hibernate. An example of a C-Operation using our API is this:

    import de.espirit.or.Session;

    import de.espirit.or.web.SessionManager;

    import de.espirit.or.schema.Entity;


    String schemaName = "schemaname";
    Session orSession = SessionManager.getInstance(getServletContext()).getSession(schemaName);


    try {
        Entity myEntity = orSession.createEntity("peopledata");

        myEntity.setValue("lastname", lastname);
        myEntity.setValue("firstname", firstname);
        // ...

        orSession.commit();
    } catch (ORException ore) {
        // error handling procedures

        session.rollback();
    }

    0
  • Zendesk API User
    Author: marius - 7/15/2010 8:36

    The CRUD operations should support: Create, Read, Update and Delete database operations.

    0
  • Zendesk API User
    Author: Peter_Jodeleit - 7/16/2010 16:48

    Here the other operations.

    Read

      Entity myEntity = orSession.find(4711, "peopledata");
      List<Entity> list = orSession.executeQuery(orSession.createSelect("peopledata"));

    Update

      myEntity.setValue("lastname", "Meyer");
      orSession.commit();

    Delete

      orSession.delete(myEntity);
      orSession.commit();

    --Peter

    0
  • Zendesk API User
    Author: marius - 7/19/2010 9:06

    Thanks for the answers.

    In the end I will have to use the FS API for the DB operations, just because there are operations which have to be taken care of, like versioning and revision information.

    I would also like to do a suggestion for the FS development team (that might be considered for later versions). This suggestion started from the following aspect:

    - just imagine that the application I need to develop with FS has around 100 tables... and about 50 tables needs to support dynamic operations which could not be covered by the FS Integration module. From this point of view I will have to implement all DAO related code operations for the 50 tables...

    which is :

    - time consuming,

    - usually, when you have to deal with code like:

          myEntity.setValue("lastname", lastname);

    there is enough place for bugs (misspelling attribute names);

    - whenever an attribute changes in the DB schema, or new show up or they are removed the code has to be changed again;

    - tests required

    - the FS Integration module is designed for Java scriplets usage...which I would strongly like to avoid (no scriplets in JSP).

    Because of these aspects and based on the fact that you already developed a nice DB design tool which produces an XSD file I would suggest the following:

    - make FS available to plugin with ORM frameworks

    - by using the XSD file there could be designed a cartridge that could be later used with an external tool (like AndroMDA) for generating basic DAO functionality, like value objects (PeopleData Java class with getters/setters), DAO classes, a.s.o.  that could be extended by customized classes in order to provide extra functionality.

    Marius

    0
  • Zendesk API User
    Author: marius - 7/19/2010 14:38

    Hi,

    By running the following code (as suggested) :

    Session orSession = SessionManager.getInstance(getSession().getServletContext()).getSession("agro");

    I get the following exceptions:

    java.lang.IllegalArgumentException: SessionManager.createSession: no handler registered for schema 'agro'
        at de.espirit.or.impl.web.SessionManagerImpl.createSession(SessionManagerImpl.java:114)
        at de.espirit.or.impl.web.SessionManagerImpl.getSession(SessionManagerImpl.java:62)

    Could you be so kind and provide me with a basic / running sample. It might be that I'm missing some configuration?

    Is there any documentation related to this? complete API docu? PDF ? ... anything that I could get ?

    Thanks,

    Marius

    0
  • Zendesk API User
    Author: marius - 7/20/2010 8:28

    This is not related to the configuration of database schema. I already did  this and this is working if I use the Integration module with the tag libs.

    What I am trying to do right now is related to the API, I need to access the  database through the FirstSpirit API (session manager). My code is located into  the a web Java action (stripes,struts ... a MVC framework).

    From the exception I got, it looks to me that I need to register a handler.  Any idea?

    0
  • Zendesk API User
    Author: Andreas-Knoor - 7/14/2010 16:58

    Marius Cimpean schrieb:

    4. From the design & architecture point of view, please let me know  which is the most recommended way by "FirstSpirit standards" to manage  entities (CRUD operations on DB records) from these customized java  action classes.

    Could you describe what functional requirements should be realized with this CRUD operations?

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.