PersistentManager Question

I have a couple of questions and I cannot find any documentation. I am evaluating this product for purchase. I was trying to understand how it work. I was able to generate classes from an E/R diagram and was wondering how the PersistentManager should be used. Should a new instance be initiatied everytime I want to read or write records from the DB? I think it is necessary for writes but what about reads? Is there any documentation on the ‘orm’ package?

Dear jvence,

Thank you for your message. We are sorry that currently we do not have API documentation for the orm package. I’ve forwarded your message to our documentation team to follow-up. Thank you for your suggestion. In the meantime, I suggest you can reference to the DBVA tutorial http://www.visual-paradigm.com/documentation/dbvatutorial.jsp for more information about how to use our orm package. The tutorial contains complete examples showing how to build web applications with the orm package.

If you have any further questions, please feel free to contact us again.

Best regards,
Rain

I think the tutorial does not go into enough details. Developers for robust applications will need to understand how to use the generated ORM libraries to develop robust, multi-threaded application. Having played around with your product, I have come across some issues in a multi-threaded environment and I am not sure where to turn for information.

We will have the API documentation for the Persistence Manager in the new version of DB-VA (VP Suite 2.1). Could you mind leave me your email address so than I can send you a copy once it was ready? You can send it to rain@visual-paradigm.com. Thanks!

In the meantime, if you have any questions/problems on using the persistence manager and the generated library, you can contact me directly. Please feel free to contact me if you have any problems.

Best regards,
Rain

Well rain, a couple of questions:
1- When do you expect the API to be ready?
2- How about answering jvence question above about the exact use of the persistent manager. Is it needed for both reads/writes - should a new instance be initialized everytime we want to access the DB, how is the best used in a threaded environment where you have several concurrent threads making DB reads/writes

[quote=Rain]We will have the API documentation for the Persistence Manager in the new version of DB-VA (VP Suite 2.1). Could you mind leave me your email address so than I can send you a copy once it was ready? You can send it to rain@visual-paradigm.com. Thanks!

In the meantime, if you have any questions/problems on using the persistence manager and the generated library, you can contact me directly. Please feel free to contact me if you have any problems.

Best regards,
Rain
[/quote]

Thanks for replying.

  1. The API should be available before the mid of October.
  2. Actually the persistence manager is a singleton class which only has one instance running. It will handle the threads automatically so you don’t need to do any special in the threaded environment. For reading the DB, you don’t need to use the persistence manager. But for writing to DB, you may need the following:

Creating Transaction:

PersistentTransaction t = PersistentManager.instance().getSession().beginTransaction();

try {
// do your work here

  t.commit();

} catch (Exception e) {
  t.rollback();
}

But for web environment, you may need the following when you read the object out for doing modifications

PersistentManager.instance().getSession().lock(object, LockMode)

This is special for the situation where the session was closed and re-created.

If you have any further questions, please feel free to contact us again.

Best regards,
Rain

[quote=Anonymous]Well rain, a couple of questions:
1- When do you expect the API to be ready?
2- How about answering jvence question above about the exact use of the persistent manager. Is it needed for both reads/writes - should a new instance be initialized everytime we want to access the DB, how is the best used in a threaded environment where you have several concurrent threads making DB reads/writes

[quote=Rain]We will have the API documentation for the Persistence Manager in the new version of DB-VA (VP Suite 2.1). Could you mind leave me your email address so than I can send you a copy once it was ready? You can send it to rain@visual-paradigm.com. Thanks!

In the meantime, if you have any questions/problems on using the persistence manager and the generated library, you can contact me directly. Please feel free to contact me if you have any problems.

Best regards,
Rain
[/quote][/quote]

Can you elaborate more on why and how this is used?

[quote=Rain]Thanks for replying.

PersistentManager.instance().getSession().lock(object, LockMode)

This is special for the situation where the session was closed and re-created.

When a session loaded a persistable object and it is closed, the object cannot be used for lazy loading or associate with other object unless it associated with an opened session by lock(). One example for the lock is the web application. Since the session will be opened and closed when executing a page, so if you want to load the persistable object at page A and use it at page B, then you have to re-associate the object with an opened session at page B using the lock().

Best regards,
Rain

[quote=Anonymous]Can you elaborate more on why and how this is used?

[quote=Rain]Thanks for replying.

PersistentManager.instance().getSession().lock(object, LockMode)

This is special for the situation where the session was closed and re-created.

[/quote]