June 2007 - Posts
Assuming you have set a generated value of any type to your entity and that it is mapped to an auto-increment field, you can get the generated key in JPA.
Before, I try to commit the transaction just to get a generated key.
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.persist(fixedItem);
em.getTransaction().commit();
fixedItem = em.merge(fixedItem);
//start another transaction, persist and then commit again
I would back then commit and then merge with the Session (EntityManager is Session in Hibernate) and then commit again. This defeats atomicity, I didn't know until now that to generate a primary you only need to flash the EntityManager.
em.flush();
//more actions here
em.commit();
Hmmm... Perhaps I'll be posting about NamedQueries next time. :)
My friend just introduced me to this (new?) feature of google called google notebook. Before, I used to use yahoo notes which is just like notepad. It sucks because I'm only able to save text and the formatting isn't saved at all. With Google Notebook, you could copy the website you're viewing as is without any modification.
I tried to copy a document from http://today.java.net/pub/a/today/2006/01/24/introduction-to-blackberry-j2me.html and see how it looked like

Almost the same ya? I think I'm gonna get addicted to this. 
In the system that I am currently maintaining, everything is a mess. You just won't know how to find something or where to find something unless you go down deep into their code. Hell!
So while debugging a javascript portion and after hours of searching I still couldn't find the method in an object for which I am looking... I thought a way of evaluating the object's method would be possible in javascript. How do you do this? It's just a few lines of code! I dunno if this will work on other browsers but it did in IE7.
for (var property in yourobject)
{
alert("Property: " + voucher[property] + "\r\n");
}
Many grown up men dreamed of having their own Robot since their childhood days. Guess what!!? You can have them now! While my friend and I were talking online about our daily programming conversation he got to mention about this site
http://mindstorms.lego.com/
OMG! A robot that you can program! Now how cool is that? See it in action
http://www.youtube.com/watch?v=KyG4tCogD2E
And how does the code for it look like? You can choose from a variety of programming languages:
http://turing.bard.edu/~ssp/NQC_Examples.html
http://parsecsys.com/rcx/
Java even has an interface for it!
http://www.slewis.com/rcxport/
If only I had the money... If only I knew of a place to buy! Oh my!
I just bought my Sony PSP about 3 weeks ago. I haven't had a chance to use its wi-fi feature since I don't have an access point to connect to at our house or in the office. You could do a lot of stuff with PSP like browse the internet, read RSS feeds, play games, watch videos, listen to music, view pictures, etc. The best ofcourse for me, is that the graphics look so close to the PS2. Probably because it has a small screen that compress the graphics.
I'd really like to try the wi-fi feature wherein you could play with friend who also has a PSP through ad hoc connection(I think this serves as P2P) or by connecting to an access point to allow multiplayer gameplay. You could enhance the functionality of your PSP by downloading homebrew apps such as a PDF reader. Hopefully I could get the most out of this cool gadget and make those homebrew apps myself! :)