CMP and BMP

hi there,
is this true?
CMP -> JTA
BMP -> EJBContext.getUserTransaction
note: CMP uses JTA to do transaction but BMP uses EJB api to do transaction handling.
Thanks
Neo

Disagree that CMP is always better than BMP. CMP is in reality merely an implementation of BMP that provides a declarative method of providing a persistence layer. You could easily use other declarative systems to provide the same service, but you are alway relying on BMP and when CMP fails to provide you need to return to the raw BMP.
It a bit like the difference between high/low level languages. We don't normally write direct assembly (yes, I am aware that real programmers yada yada yada) but we do use it, and sometimes you actually have to write it for specialised applications - most notably for high performance.
Both have their pluses and minuses, and you need to know when to use one over the other.

Similar Messages

  • Could I build 1:N relationship between CMP and BMP?

    Hi, as subject, Could I build 1:N relationship between CMP and BMP?
    Thanks a lot!
    a13519

    Container managed relationships only apply to CMP beans. You can look at the DTD in appendix B of the EJB spec or chapter 10 where they make this distinction.

  • CMP and BMP configure for deploying in weblogic

    how to run CMP and BMP in weblogic and configure in welogic
    tell me the steps to be followed for connection pooling and deployement and configure in weblogic builder....

    Disagree that CMP is always better than BMP. CMP is in reality merely an implementation of BMP that provides a declarative method of providing a persistence layer. You could easily use other declarative systems to provide the same service, but you are alway relying on BMP and when CMP fails to provide you need to return to the raw BMP.
    It a bit like the difference between high/low level languages. We don't normally write direct assembly (yes, I am aware that real programmers yada yada yada) but we do use it, and sometimes you actually have to write it for specialised applications - most notably for high performance.
    Both have their pluses and minuses, and you need to know when to use one over the other.

  • CMP and BMP in application

    I am new to EJB, please help me on this:
    Can i have mix of CMP and BMP in my application?
    Is it best enforce that all entity bean in either one but not both?

    You are impling that BMP is DB-dependent. The SQL generated by the >Container is nothing magical. It is no more DB independent than SQL >written by the developer. You don't have to be DB-specific to use BMP, >but you do have to be appserver-specific to use CMP.By Db independent I mean that the sql code for container call back methods is generated by Container. You dont have to do anything. If you are deploying bean for oracle or sql , container will take care for that. Refer to the specs There is brief para on advantages of CMP.
    For BMP you have to change the code according to the database. Container will not do anything for that.
    "2. Reduced development efforts."
    Yes, marginally, but the reduction in initial development time must >be weighed against:
    The tools (or lack thereof) provided to map the beans to the tablesWell even if you are working with BMP you have to be aware of that. There are various performance improvement setting which are app server specific. It doesnt matter if you are using BMP or CMP for that matter
    The time spent dealing with appserver vendors when things don't workOfcourse this happens with BMP also.
    The inherent limited flexibility of CMPAlmost 90 % of the scenarios can be delt with CMP. Yes if not you can use BMP.
    Also if time is such a factor, you should probably be generating your >beans (either CMP or BMP). This eliminates the development effort >difference between them. Of course that means developing BMP will be >faster since you don't have to muck about with the appserver, mapping >beans, marking methods as read-only, etc.Ha... I cannot take it. In general I can say It doesnt matter if you are using BMP or CMP , you have to be aware of different performance and other settings which are app server specific.
    Remember CMP is available for 2 reasons:
    1) So you can minimize development effort on simple Object-to-RDB >mappingsThey now support various relationships like 1-1,1-many, many-many
    2) So that the big vendors (IBM, BEA, etc.) who were involved in >drafting the spec can provide "features" not in the specification, >encouraging vendor lock-in. Any Specification is not complet or exaustive. Vendors need to fill the gap.
    --Ashwani

  • Default Isolatioin level in CMP and BMP

    Hi All,
    If we don't set isolation in a descriptor (in case of CMP) then what is the default level ?
    and what is the default level in case of BMP?
    Is it a Database dependent?

    Hi,
    Didnt find this reference in any books/pdf?
    Did u find the same?
    Seetesh
    isolation-level defines a valid transaction isolation level to apply to specific EJB
    methods. The following are possible values for isolation-level:
    TransactionReadUncommitted:: The transaction can view uncommitted updates from other transactions.
    TransactionReadCommitted: The transaction can view only committed updates from other transactions.
    TransactionRepeatableRead: Once the transaction reads a subset of data, repeated reads of the same data return the same values, even if other transactions have subsequently modified the data.
    TransactionSerializable: Simultaneously executing this transaction multiple times has the same effect as executing the transaction multiple times in a serial fashion.
    For Oracle databases only:
    TransactionReadCommittedForUpdate
    TransactionReadCommittedForUpdateNoWait

  • Nobody knows this fundamental question - CMP, CMT, BMP, BMT. Surprised !!

    Hello,
    I've talked to many experts and read books on EJB but none of them gave me a clear cut answers. What are the definitions of CMP, CMT, BMP and BMT? No one could explain "Persistent" from "Transaction" properly. No books clearly define them at all. Some say BMP means BMT and CMP means CMT. Some others say they are totally different concept. Others even say different stories. Actually, when we create EJBs (in Visual Cafe as an example), we can tell whether the bean is CMP or BMP but there os no place where we can define the transaction mode (BMT or CMT). How come do so many people get confused about this fundamental concept? Can anybody explain them clearly please?

    CMP = Container Managed Persistence
    This means that the container (part of the EJB Server) automatically handles persisting your bean to a DB. So if you have an Entity Bean, for example, that has some properties (like name, size) and a table in the database with the fields name (as a varchar), size (as an integer), then when you set the bean's properties to "Joe" and "14", you can then look in your database and those values will be there. You (the developer) do not have to write any code to put those values into the DB.
    BMP = Bean Managed Persistence
    This means that (in the above example of an EJB with properties name, size), if you set your bean's name to "joe" and size to 14, those values will NOT go into the DB unless you (the developer) put them there.
    CMT = Container Managed Transactions
    A transaction is really either one statement (or action) or a bunch of them that are grouped together. If it is a group, then for any one of them to be executed / committed, they must all execute successfully. If even just one of the actions / statements fails, they all fail (or are all "rolled back", i.e. un-done)
    CMT means that the container (EJB Server) will handle making sure that all the actions or statements from a transaction (i.e. a particular context of actions kicked off when an EJB is called) are completed successfully. If they are, the container will commit (execute) all the statements and return "success". If any one of them fails, the container will handle rolling back (un-doing) all the statements. This is VERY useful, as you do not need any special if statements or try-catches, the container does it for you.
    BMT = Bean Managed Transaction
    This means that you (the developer) will have to logically group together all that actions that you consider for a transaction. If any one of them fails, you will need to make sure all of them are rolled back and that "failure" is returned to the caller. If they are all successful, you will have to return success.
    You can do this by using the below code:
    (in all the code below, they may wrap from one line to the next, just pay attention to where the ";" is)
    //import Transaction
    import javax.transaction.UserTransaction
    //make a new transaction:
    UserTransaction userTran = ( UserTransaction ) initialContext.lookup("java:comp/UserTransaction");
    try
    //And then marking the beginning of the transaction:
    userTran.begin();
    //Then Do your stuff (i.e. the actions)
    myPersonalBusinessMethods();
    //commit the transaction cause it's all ok
    userTran.commit();
    catch (Exception e)
    //rollback (un-do) all the stuff cause error occurred
    userTran.rollback();
    Hope all this helped and finally explained it! Feel free to throw some duke dollars my way if it did! ;P
    Robert

  • CMP vs BMP

    hi friends
    coud any tell me the core benefits/asvantages of using CMP beans on the BMP ot vice versa!!!
    or any disadvantage of using any specific type... with that were should be use the CMP and where BMP
    thxs!

    CMP is advantegous for portability. The sql statement/parameter/tuning is done outside the java code. Very good approach if you are J2EE component vendor because your client may not use to Bea, IBM, Sun, or XXXXX product.
    BMP is adventegous if you know how to tune the sql by hand, by assumption that your tuned-by-hand sql far overperform the performance of CMP's SQL, otherwise CMP is still recomended. People won't use this approach if they sell J2EE component, why? Not everyone will use WebLogic+Oracle but your code is optimized for WebLogic+Oracle.
    Please pardon my bad english.

  • Print images in PNG and BMP formats

    I have converted images from xwd to bmp by using JAI. now I want to print them.
    How can I print PNG and BMP Files? How can I read images in different formats and make them print.
    Please help me !

    JAI follows the Java 2D printing model. All you need to do is to read your PNG, BMP images as RenderedImage, Renderable, or BufferedImage objects. To print an image, draw the image object on the printer's graphics context using one of drawImage(), drawRenderedImage(), and drawRenderableImage() methods of the Graphics2D class.
    I have some sample code at http://www.geocities.com/larryhr/samplecode/samplecode.html. See the Printing section. JAIImagePrint.java should give you some indication as to how to print images read by the JAI codec.

  • Why java only can display GIF file not jpeg and BMP ??

    Did anyone know why java only can display GIF file not in jpeg and BMP ?? This is because the quality of GIS is not as good as Jpeg and BMP
    any code to load the display process ??
    thx guys !!!

    you can do jpegs but im not sure about bmps.
    The only thing ive noticed is that java cant support transparent jpegs, only transparent gifs
    Jim

  • Which should I use (CMP or BMP) for my Web Application?

    I am developing an Web Application with Oracle Database. In this work, I always use the SQL sentences in complex (Joining many tables with WHERE condition). So that, I want to be adviced in developing this web application with CMP or BMP or other opinions?
    Thanks in advance!

    If you want to write long (optimized) SQL queries, than you shouldnt use
    entity EJB's at all.

  • CMP and Serializable fields

    Hello,
    I would like to declare a field in an CMP Entity Bean to hold Serializable objects.
    It seems to work fine for primitive types and arrays of them but I get an exception as soon as I try to set the field via the bean remote interface with an instance of a user created class implementing Serializable :
    com.evermind.server.rmi.OrionRemoteException: Method invocation failed (Invalid return command: 6)
         void com.evermind.server.rmi.RMIConnection.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(java.lang.Throwable)
              RMIConnection.java:1499
         java.lang.Object com.evermind.server.rmi.RMIConnection.invokeMethod(com.evermind.server.rmi.RMIContext, long, long, java.lang.reflect.Method, java.lang.Object[])
              RMIConnection.java:1452
         java.lang.Object com.evermind.server.rmi.RemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
              RemoteInvocationHandler.java:55
         java.lang.Object com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
              RecoverableRemoteInvocationHandler.java:22
         void __Proxy1.setBehaviour(java.io.Serializable)
         void cern.laser.business.test.ConsoleConfigurationEntityEJBClient.main(java.lang.String[])
              ConsoleConfigurationEntityEJBClient.java:27
    The class looks like :
    public class MyClass implements java.io.Serializable
    private String s;
    public MyClass ()
    s = new String("ciao ciao");
    The corresponding database column is defined as BLOB.
    Thanks for your help,
    Francesco.

    Can any body tell me the relation between cmp and cmr
    fields in CMP beans
    Thanks in Advance
    SudhakarWe could say:
    If an Entity EJB is a record of a database table, a CMP is like a simple table column and a CMR represents a table column refering to a Foreign Key.
    Fil

  • Cmp and datasource

    Hi,
    I have a application with CMPs, and in my iAS there are 5 Data Sources.
    How to configure an application to access a Data Source ?
    Jordi Pinyol Essi Projects
    Ingeniero de Desarrollo
    [email protected] t +34 977 221 182
    http://www.essiprojects.com f +34 977 230 170

    Hello,I need to change at runtime the properties of
    the connection, because my database has several users,
    I am working with CMP EJB . How could I do it?
    Thanks in advanceYou may write your own data source wich you will pass required data (user name) to through some thread oriented storage...
    class Store {
    static Map cache = new HashMap();
    static void setUserName(String userName) {
        cache.put(new Integer(Thread.currentThread.hashCode()), userName);
    static String gerUserName() {
        return (String)cache.get(new Integer(Thread.currentThread.hashCode()));
    EJB:
    setEntityContext(EC ec) {
       Store.setUserName(ec.getCallerPrincipal().getName());
    YourDS:
    getConnection() {
       return ds.getConnection(Store.getUserName(), ...);
    ...

  • CMP and capture-schema problems

    I am trying to deploy a CMP on Sun App Server 8, and I'm having a few problems. I am quite new to both CMP and Sun App Server 8.
    I've created a simple table Room in mySQL DB, containing only id (varchar) and description (varchar). I'm running this command to capture the table schema
    capture-schema -username username -password pwd -dburl jdbc:mysql://localhost/test -driver com.mysql.jdbc.Driver -out test.dbschema
    Do I need to enter the -schemaname and -table parameters as well? I'm assuming that since the url is pointing directly to the test schema in mySQL and it only contains the room table, I don't need these 2 parameters.
    test.dbschema gets generated, but when I use the deployment tool and create the database mappings to the entity bean using this schema file, no mappings are created.
    Any help?

    Hello,
    I have similar problem and I'm really confused about it.
    Working with:
    Java System Application Server Platform Edition 8.1 2005Q1 UR1
    mysql DataSource and Container Managed Persistence
    mysql-connector-java-3.0.8-stable-bin.jar
    I have problem with deploy:
    Fatal Error from EJB Compiler -- JDO74025: JDOCodeGenerator: Caught an Exception validating CMP bean 'Sets' in application 'isvl' module 'isvl-EJBModule': JDO72335: If the table sets for the bean corresponding to the generated class isvl.model.set.SetBean470758938_JDOState is mapped as the primary table, it must have a primary key.Choose a different primary table or verify that the contents of the schema file are correct.
    Choose a different primary table or verify that the contents of the schema file are correct. at com.sun.ejb.codegen.CmpCompiler.compile(CmpCompiler.java:274) at com.sun.ejb.codegen.IASEJBC.doCompile(IASEJBC.java:615) at com.sun.ejb.codegen.IASEJBC.ejbc(IASEJBC.java:563) at com.sun.enterprise.deployment.backend.EJBCompiler.preDeployApp(EJBCompiler.java :340) at com.sun.enterprise.deployment.backend.EJBCompiler.compile(EJBCompiler.java:209) at com.sun.enterprise.deployment.backend.AppDeployer.runEJBC(AppDeployer.java:284) at com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:176) at com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.j ava:107) at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:146) at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPh ase.java:71) at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeplo ymentService.java:633) at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentSe rvice.java:188) at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentSe rvice.java:520) at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:143) at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:172)
    Have you seen this problem?
    Thanks.

  • Can TopLink CMP and POJO persistence be mixed (for incremental migration)?

    Is it possible to mix TopLink CMP and POJO persistence in one application server container? Does anyone already have experiences with such a setting?
    Background: We currently maintain an application that uses Toplink as CMP 1.1 provider for its entity beans. As this architecture is quite out-dated, we'd like to move from CMP 1.1 to POJO based persistence with TopLink (native, no JPA) and Spring inside the appserver.
    Is only a "big-bang" migration feasible? Or is there a way to use CMP and POJO persistence with TL side-by-side in one container? That would extremely handy allowing us to migrate each entity bean at a time.
    I would very much appreciate your input/opinion!
    Sebastian
    Application server is Bea Weblogic 8.1SP6
    Toplink version is 9.0.4.9
    Java version is 1.4.2

    Thank you a lot for your answer!
    I understand that with SessionAccessor from the oracle.toplink.ejb.cmp package, we can get access to the current CMP session.
    We'd like to use the TopLinkDaoSupport class from Spring's TL integration and for this, Spring wants a session factory injected.
    Is there a way to get something like a TL session factory for use with Spring in a CMP environment?
    Thanks again for your time!
    Sebastian

  • How to get connection when mixing cmp with bmp

    Hello,
    I have a CMP-based system in which I need to have a method in a
    stateless session bean to use BMP. In order for that method to
    participate in a larger transaction, I need to make sure that I grab
    the database connection that is used by that transaction. How would I
    do that?
    For simple BMP, I would get my connection like this
    InitialContext ctx = new InitialContext();
    DataSource ds = (javax.sql.DataSource)ctx.lookup("java:/someDataSource");
    java.sql.Connection conn = ds.getConnection();
    But in this case, how can I be sure that the connection I got is the
    one that is used by the current transaction? Or does it happen
    auto-magically?
    I have pored thru the API and can't seem to find a way to get a
    Connection from a javax.ejb.SessionContext, which I do have a handle
    to.
    Thanks in advance,
    Chishun Kwong

    [email protected] (Chishun Kwong) wrote in message news:<[email protected]>...
    Hello,
    I have a CMP-based system in which I need to have a method in a
    stateless session bean to use BMP. In order for that method to
    participate in a larger transaction, I need to make sure that I grab
    the database connection that is used by that transaction. How would I
    do that?
    For simple BMP, I would get my connection like this
    InitialContext ctx = new InitialContext();
    DataSource ds = (javax.sql.DataSource)ctx.lookup("java:/someDataSource");
    java.sql.Connection conn = ds.getConnection();
    But in this case, how can I be sure that the connection I got is the
    one that is used by the current transaction? Or does it happen
    auto-magically?
    I have pored thru the API and can't seem to find a way to get a
    Connection from a javax.ejb.SessionContext, which I do have a handle
    to.
    Thanks in advance,
    Chishun KwongI realize after posting this message that this is actually kind of a
    dumb question. This has nothing to do with mixing BMP and CMP, even in
    pure BMP, you have to wonder if the connection you get is the one used
    by the current transaction (if there is one already), and of course it
    is the container's responsibility to make sure.
    CSK

Maybe you are looking for

  • How do I change my printer preset on my iMac?

    I have a Canon Pro9000 MarkII and it gives me an error "Support Code : 88 The media type and paper size are not set correctly.  Stop printing, change the settings, and print again. If you selected Board Paper as the media type, you need to set the pa

  • Some of my email is getting filtered out so I don't receive them.

    Some of my emails are getting filtered out after it is accepted and received by me.com services.

  • VL10B - Selection by Delivery Date

    Hi all, We have a requirement in transaction VL10B, wherein the STOs have to be picked as per Delivery Date. However in the standard, VL10B picks the STOs as per the Delivery Creation date. Is there any Exits or BADI to solve this?

  • Adobe form copies

    Hi experts,   I'm facing a problem. On dynpro abap  screen we input the copies no. on screen, and press "print" button to preint PDF forms ( not Interactive form, just static PDF form ).  And every copyies has different title. Is it possible ? Or is

  • Delivery-related billing for TAS : take VPRS value from GR or Invoice

    Hello, One my customers currently invoices stock items and Third-Party Items separately. He now wishes to invoice both items together. In Third-Party standard flow no delivery is needed. In order to invoice both items together I have now activated th