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

Similar Messages

  • Does anyone know this easy question?

    I've been trying to figure this out. It seems like it is easy to do but I can't figure this out. I want to put the string, "Fancy Big Label" right below this string, "Plain Small Label" in the center. Does anyone know how to do this? Thanks for those who answer.
    PK
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    public class LabelPanel extends JPanel
         public LabelPanel()
              JLabel plainLabel = new JLabel("Plain Small Label");
              add(plainLabel);
              JLabel fancyLabel = new JLabel("Fancy Big Label");
              Font fancyFont = new Font("Serif", Font.BOLD|Font.ITALIC, 32);
              fancyLabel.setFont(fancyFont);
              fancyLabel.setHorizontalAlignment(JLabel.CENTER);
              add(fancyLabel);
         public static void main(String[] args)
              LabelPanel lp = new LabelPanel();
              JFrame frame = new JFrame("Label Example");
              frame.getContentPane().add(lp);
              frame.addWindowListener(new WindowAdapter()
                   // Open and closed braces are required because it is a class.
                   public void windowClosing(WindowEvent e)
                        System.exit(0);
              frame.pack();
              frame.setSize(400, 150);
              frame.setBackground(Color.white);
              frame.setVisible(true);
    }

    What happens with the current code?
    I suspect it is to do with the layout manager. See the section in the Java tutorial on Swing layout managers.
    John

  • 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.

  • HT1311 I know this is a basic question, however, how do i change my pass word on itunes to stop my kids from automatically buying tunes from the I store... as my card details are already saved they just log in with their ipods and download via my account

    I know this is a basic question, however, how do i change my pass word on itunes to stop my kids from automatically buying tunes from the I store... as my card details are already saved they just log in with their ipods and download via my account

    http://support.apple.com/kb/HE36
    Regards.

  • Can you print from an iPad 2 using 3G in a home with no computer or wifi by using an iPhone 5 hot spot connection if the printer has been set up in another place with live wifi? I know this question is loaded but my dad lives in a rural area

    Can you print from an iPad 2 using 3G in a home with no other computer or wifi by using an iPhone 5 hot spot connection if the printer has been set up in another place with live wifi? I know this question is loaded but my dad lives in a rural area and is wanting a printer to use occasionally. He doesn't want to deal with a computer and I keep his iPad updated for him at my home.  Please shed some light on this for us PLEASE. Thanks

    In that case, it should be possible. I haven't tried this directly, but I believe it should work.
    You'll need to get an actual AirPrint compatible Printer.
    Check here for a list of Printers you can choose from.
    http://support.apple.com/kb/ht4356
    Once you have the compatible printer, using the Hotspot feature from the iPhone he'll have to create the Wifi bubble form the iPhone, and connect the Printer to that Wifi network.
    Then connect the iPad to that same Wifi network provided by the iPhone. When all that is done, the printer should appear in any of the Apps that can Print under the Action Arrow button.
    For instance in email, pressing the action arrow should show a Print option. In there the printer should appear.
    Alternatively you can simply buy a wireless router and setup the network through there even if there is no internet attached.  Connect the wireless printer to the router network, and connect the iPad or iPhone to that same wifi network to print.

  • If I upgrade to Mountain Lion on the computer that will install it, will my WIFI still work on the computer that cannot be upgraded? I know this is a very basic question

    If I upgrade to Mountain Lion on the computer that will install it, will my WIFI still work on the computer that cannot be upgraded? I know this is a very basic question. Trying to hold out as long as I can, but purchasing an iPhone for Christmas and new iMac next year when warrently expires.

    Thank U very much for the quick reply, I wanted to upgrade this weekend, but still on the fence. I can live with the software that is not compatible, they are on another compuetr, just didn't want the obvious stuff to stop working.

  • Okay My Aunt has given me her old updated iPhone 5c where she has lost her password to her icloud account and doesnt know her sercurity questions to reset it is there anyway to bypass this with the iOS 8.1.3

    Okay My Aunt has given me her old updated iPhone 5c where she has lost her password to her icloud account and doesnt know her sercurity questions to reset it is there anyway to bypass this with the iOS 8.1.3

    You cannot bypass this security measure. You need to recover your AppleID from appleID.apple.com
    If you can't send the password recovery to a secondary email, contact Apple Support.

  • Hi I can't purchase in itunes, I don't know the security questions! The email set up to recover is not a real email my daughter set it up please help how can I fix this?

    Hi I can't purchase on itunes as I don't know the security questions, the email to retrieve answers is not a valid email my young daughter set it up wrong please help!

    You won't be able to change the rescue email address until you can answer 2 of your questions, you will need to contact iTunes Support / Apple to get the questions reset.
    Contacting Apple about account security : http://support.apple.com/kb/HT5699
    When they've been reset you can then use the steps half-way down this page to udate your rescue email address for potential future use : http://support.apple.com/kb/HT5312

  • I DON'T KNOW MY SECURITY QUESTIONS BECAUSE MY DAD MADE THIS ACCOUNT A FEW YEARS AGO! HOW DO YOU CHANGE THEM!?

    I DON'T KNOW MY SECURITY QUESTIONS BECAUSE MY DAD MADE THIS ACCOUNT A FEW YEARS AGO! HOW DO YOU CHANGE THEM!?

    So how do I change it

  • I know this is a stupid question but can u put movies on thi 5G ipod?

    i know this is a stupid question but can u put movies on thi 5G ipod? like longest yard, anchor man, ect.
    Nano 4GB black,Moto RAZR V3 black, PSP, all kinds of cases for nano,radio/remote   Windows XP   <img src="http://i36.photobucket.com/albums/e13/superman5656/s.gif"align="right"</span>

    i dont have one yet i was just wondering i was thinking about it thanks
    Nano 4GB black,Moto RAZR V3 black, PSP, all kinds of cases for nano,radio/remote   Windows XP   <img src="http://i36.photobucket.com/albums/e13/superman5656/s.gif"align="right"</span>

  • I know this is the wrong forum, but- (Mac question)

    I know this is the wrong forum, but…
    Can anyone enlighten me?
    How did a folder named just "Adobe", containing only something called "Acrobat.com.app"), end up in my root Applications folder?
    Double clicking on "Acrobat.com.app" launches an installer that wants to install something called "AIR".  What is that and what is it needed for?
    What forum should I be posting this in?
    A global search and searches in the Acrobat Macintosh forum were not helpful.
    Can I just delete that Adobe folder or ignore it?  It has identical Creation and Modified dates of January 15, 2010 17:56, which raises more questions than it answers.
    Any input will be appreciated.
    Wo Tai Lao Le
    我太老了

    pwillener wrote:
    …Adobe Reader 9.0 came with two installers: one bundled with Acrobat.com and Adobe AIR (AdbeRdr90_en_US.exe, 34302 KB), the other one without any bundled software (AdbeRdr90_en_US_Std.exe, 25772 KB).
    …<snip>…
    P.S. what I wrote above is about the Windows version; I assume that the Mac versions are the same.
    Maybe… kinda, sorta…  There are no ".exe" files in the Mac world. 
    I've never downloaded or installed either Acrobat.com or Adobe AIR.  It has to have been the Acrobat Reader 9.3 update for the Mac that installed that sucker on my Mac. I had certainly never seen it before.
    That, on top of the inexcusable, abominably surreptitious "Growl" installed by Adobe behind my back, strengthens my resolve not to acquire any more Adobe products, free or otherwise. 
    What in blazes are the Adobe corporate folks thinking? 
    Wo Tai Lao Le
    我太老了

  • Nokia 5233 Storage Question. You need to know this...

    Hi, I'm not new to Discussions. PLEASE NOTE BEFORE READING THIS THREAD: I've digged EVERYwhere you can think of, so please have in mind that I come here because I really need to know this, I don't want to double-post anything or start a spam war or something. Thank you.
    I was facing problems with my device, Nokia 5233. Sometimes the phone asks for too much time to do a simple task, and I have tried to defragment the memory card to see if it helps, but in the end it made no difference at all.
    After that, I was recording a video and it went just fine. The problem happened later on, when I decided to view the video and it was lagging the image. I mean, the image was freezing sometimes but the audio was OK. I recorded another video after that and it had the same symptoms. NOTE: THE MEMORY CARD WAS WITH 1GB+ OF STORAGE REMAINING AVAILABLE TO BE USED.
    This is about the stock memory card that comes with the cellphone, 2GB storage capacity, Micro SD card.
    After I was told that this is a symptom of the memory card, I wonder if this is supposed to happen with the card that comes with the cellphone. I was **bleep** because I REALLY f***ing need those videos and this turned out to be a real nightmare because when I tried to back up my data using Nokia's software, I ended up with a corrupted file, it was supposed to be a BACKUP and the software just MOVED my SMS messages from the cellphone to my computer and I now can't move it back to the cellphone. But here, my deal is the memory, I changed it to another, higher capacity card, a Kingston Micro SDHC 4GB memory card. And still, I'm facing another issue:
    I want to know what is the REAL extended memory capacity for Nokia 5233
    I ask this because after googling about it for a few hours, I've found so many different opinions...First a guy said it's best not to upgrade the amount of memory at all, because of my device's limitation, second I read somewhere else I can upgrade the amount of memory up to 8GB and the phone "will still recognize it" and then just when I thought I was done with it, I have talked to Nokia Care on Twitter about it and they said I can be facing 'compatibility issue' with it.
    According to his statement, "Unsupported memory cards may just work for small sizes of data, but might give issues wt bigger amounts, depending on the mmc".
    That explains the issue with my cellphone's default video recorder/player. But then, again, Is that supposed to happen with a stock memory card?! I guess it's NOT, is it?
    AND THEN, AGAIN, NOTE: THE MEMORY CARD WAS WITH 1GB+ OF STORAGE REMAINING AVAILABLE TO BE USED.
    So, AFTER recording a 71MB video file, I was viewing it again, kinda hoping it was happening again because this time, it is a 4GB of memory.
    I now decided to dig a little bit using Wikipedia, and then I found what I was afraid of:
    "Devices that use SD cards identify the card by requesting a 128-bit identification string from the card. For standard-capacity SD cards, 12 of the bits are used to identify the number of memory clusters (ranging from 1 to 4,096) and 3 of the bits are used to identify the number of blocks per cluster (which decode to 4, 8, 16, 32, 64, 128, 256, or 512 blocks per cluster).
    In older 1.x implementations the standard capacity block was exactly 512 bytes. This gives 4,096 × 512 × 512 = 1 gigabyte of storage memory. A later revision of the 1.x standard allowed a 4-bit field to indicate 1,024 or 2,048 bytes per block instead, theoretically yielding up to 4 gigabytes of memory storage. However the specification specifies 2 gigabytes as the maximum capacity.
    Host devices designed before this change may incorrectly identify such cards, usually by misidentifying a card with less capacity than is the case by assuming 512 bytes per block rather than 1,024 or 2,048.
    For the new SDHC (2.0) implementation, 32 bits of the identification string are used to indicate the memory size in increments of 512 bytes. The SDCA currently allows only 26 of the 32 bits to be used, giving a maximum size of 32 GB. All SD cards with a capacity larger than 4 GB must use the 2.0 implementation at minimum. Two bits that were formerly reserved and fixed at 0, now called the "CSD Structure", are being used for identifying the type of card, 0 is standard capacity; 1 is high (SDHC) and extended (SDXC) capacity; 2 and 3 are reserved. Older host devices are not aware of this new field thus cannot correctly identify SDHC or SDXC cards."
    Source: http://en.wikipedia.org/wiki/Micro_sd_hc
    So in other words, it can be that my device does not recognize my Kingston SDHC 4GB Micro DS Card correctly. Oh I mean the STOCK, 2GB Micro SD card. And POSSIBLY my Kingston SDHC card.
    Is that correct?
    What is the storage limitation for Nokia 5233?
    Please answer this guys, I hope we can share the knowledge to anyone else who's planning to upgrade the memory for their Symbian-based smartphones.

    I don't mean the card class, I just meant the card type. Nokia is SUPPOSED to work out with majority of the cards out there, specially Symbian devices, so you can take the card off of your previous Symbian-based cellphone and then USE IT on another Symbian-based device, regardless if it is SD or SDHC.
    Look, I just want to know these:
    What is the storage limitation for Nokia 5233?
    Is Nokia 5233 supposed to work with SDHC or not?
    Simple as that.
    Answers?

  • Fundamental question on EJB, JNDI and client jars

    Hi,
    This is a very fundamental question on EJBs and their clients - what
    all should go into the client jar of an ejb?
    I know for sure that just the remote and home interface classes of the
    ejb are sufficient on the client's classpath to work with an EJB on a
    totally different server, but I dont understand the logic behind it.
    If the client has to pass its object parameters over the network to
    the server where the ejb bean is located, should the container
    generated stub not be present on the client's classpath? After the
    client does the JNDI lookup of the ejb home on the server, how does it
    serialize and pass the parameters over the network if the container
    generated stub is not present?
    Any help would be greatly appreciated. Pointers to material on the
    internet which explain this/related things in detail would be a great
    help.
    Thank you,
    Anoushka

    hello,
    well, the process is fairly simple actually.. The client needn't necessarily have
    the container generated stub. as a client u could contact what is known as a boot-strap
    service to download the stub over the wire.. infact one of the advantages of RMI
    is precisely that. and since RMI is the underlying architecture of EJBs, it all
    becomes rather simple. when u 'lookup' a bean, what u are in essence doing is
    asking the server to send down the stub to your JVM. well.. right now this is
    what i got time for..i will try to post a lengthier explanation in a couple of
    days at leisure..
    Vijay
    "Anoushka" <[email protected]> wrote:
    >
    Hi,
    This is a very fundamental question on EJBs and their clients - what
    all should go into the client jar of an ejb?
    I know for sure that just the remote and home interface classes of the
    ejb are sufficient on the client's classpath to work with an EJB on a
    totally different server, but I dont understand the logic behind it.
    If the client has to pass its object parameters over the network to
    the server where the ejb bean is located, should the container
    generated stub not be present on the client's classpath? After the
    client does the JNDI lookup of the ejb home on the server, how does it
    serialize and pass the parameters over the network if the container
    generated stub is not present?
    Any help would be greatly appreciated. Pointers to material on the
    internet which explain this/related things in detail would be a great
    help.
    Thank you,
    Anoushka

  • Did you know this was up on FB?

    Did you know this was up on FB? https://www.facebook.com/events/1590846764481403/1​593647247534688

    You are absolutely right, it is good business practice to check out the offerings from a company before you show or give it to your customers.
    I guess I just assumed that there would be a cut-out on the front cover of the Aperture books, since the soft cover books I ordered from iPhoto did have the front cover cut-out.
    My question, however, is where in the description of the Aperture hard cover book does it state that the cover photo is pasted on ? It is difficult to tell how the front cover is constructed from the photos on the Aperture web site.
    ...... I may have missed it.
    A lesson learned!
    Thanks for your comments.

  • TS2446 So I have an iphone and for some reason I don't know the password for my Apple ID so I can't download apps and I don't have the password to my email to change it and I don't know the secret questions , what can I do to make a new Apple ID ?

    So I have an iphone and for some reason I don't know the password for my Apple ID so I can't download apps and I don't have the password to my email to change it and I don't know the secret questions , what can I do to make a new Apple ID ?

    I have the same problem - it is maddening. I rely on this iPad for work so this is not just an annoyance! The above solutions of changing the appleid on the device or on the website do not work.
    The old email address no longer exists - I haven't used it in a year probably and I no longer have the account.  I logged into the appleid website and there is no trace of the old email address so there is nothing that can be deleted or changed there.  On the iPad there is no trace of the old email address so nothing can be deleted there either. I have updated the iPad software and the same problem comes right back.  Every 2 seconds I am asked to log in using the old non-existent email.  The device is currently useless.
    The only recent change to anything was the addition of an Apple TV device, which was set up using the correct login and password.
    Does anyone have any ideas? The iPad has been backed up to the iCloud so presumably it now won't recognize the current iCloud account? So restoring may notbe an option?

Maybe you are looking for

  • 200 Point Limit Exceeded

    We only have about 30 actual datapoints, but the PLC is handling all engineering unit conversion and alarm checking.  So for each datapoint requires that Lookout set or monitor 5 real values (Hi and Lo setpoints, Engr. conversion constants, and measu

  • Sync Notes to iPhone

    How do I sync my Entourage Notes with the notes in my iPhone? Thanks John

  • Will my first gen macbook work with ipad 2's face time?

    will my first gen macbook work with ipad 2's face time?

  • New update to 3.15.5 seems to break bootloader, getting black screen

    I did 'pacman -Syu' last night and today all I get is a black screen after post.  It's the same behavior that I get with the live arch image when trying to use UEFI boot.  I am posting this from a fedora live image right now.  I originally had to ins

  • No space on CD-R even though I have!

    iTunes tells me that when I'm going to burn an audio CD (which has max capacity of 80min) that there isn't enough space on the CD, and that I will have to burn the playlist over several CDs instead. The problem is that I am certain that I have enough