Daily photograph for 2008-05-11 - "bus stop"

Today's photograph on my photoblog, "Photo-Persistence"

Archive for

Multiple databases specified in hibernate.properties

Wednesday, February 25th, 2004

Looking at a little tool project and I’m going to give Hibernate another kick at the can. Used it before on another small project in the past.

On this project, I’ll be connecting to 2 different datasources. The first datasource I’ll just be doing read-only queries. The second datasource I’ll be inserting data based on what I read & rearrange from the first datasource. I’m looking at how to specify using multiple databases. I can’t see any way to give a name to a datasource within hibernate.properties to distinguish between the two.

One way I was thinking I might have to do this is create 2 different hibernate.properties files (ie, ds1.properties & ds2.properties) and then passing whichever one I needed at that time into Configuration.setProperties(). Is there any smarter/easier way to do this? I’ve got this working and it seems alright.

Update: this didn’t turn out to be too difficult. I just make 2 different calls to my cfg files when I need my connection. Maybe there’s a more elegant way of doing this, but it works fine for me.

foo.java:
SessionFactory sf = new Configuration().configure("/configA.cfg.xml").buildSessionFactory();
Session sess = sf.openSession();

bar.java:
SessionFactory sf = new Configuration().configure("/configB.cfg.xml").buildSessionFactory();
Session sess = sf.openSession();

Archive ant target

Friday, February 20th, 2004

Lance has a snippet you should add to your ant scripts to make backups of your code. I have a similar target (listed below), but I like the way he does his with prefixes and additional excludes. I first created this when I was doing solo development and didn’t have cvs in place. Also very nice if you need to make regular backups. I’ll have to remember to update my scripts like his.


<!-- ========================================================
archive: zip up the source since i don't always have CVS available
-->
<target name="archive">
<tstamp>
<format property="archive.time" pattern="MM_dd_yyyy-hh_mm_aa"/>
</format>
</tstamp>
<jar jarfile="${archive.dir}/${app.name}_${archive.time}.zip" basedir="${home.dir}" excludes="**/*.zip"/>
</jar>
</target>

I am the next Barbie doll

Tuesday, February 17th, 2004

This one made me laugh out loud. From the Gothamist

Supposed new love interest for Barbie, “Blaine,” sounds like a loser as well…not to mention gay.

Ken has been retired and there’s a new man on the scene. The replacement doll for Barbie’s boyfriend is Blaine. I can dig that. Barbie’s got a sweet figure and all the right curves.

I better grow out my hair and sideburns. At least he’s spinning tunes at the turntables and not doing something lame..

Turning 30 in NYC

Monday, February 2nd, 2004

Jenn had been planning for a long time a big surprise for my 30th birthday. She definitely surprised me this weekend. It was supposed to be the weekend before, but my passport expired on my birthday and I wasn’t the keenest on getting it renewed prior to expiry since I didn’t figure I’d be travelling with it until the honeymoon.

So, I was told that Friday, I needed to pack some clothes and leave work at 3pm. After juggling some work stuff, I made it happen. As the time approached, I had to get myself to the airport. I didn’t know where I was going until we got to the ticket desk. Jenn got us flights to Newark, NJ and then we shuttled into NYC. She booked us an amazing hotel, The Casablanca, literally paces from Times Square. I was shocked and amazed that she pulled this one of. We spent the weekend doing the normal tourist stuff (I’ll give the full rundown with photos once I’ve got more time).

Celebrity spottings:

  • Director Peter Bogdanovich in Bloomingdales. Interesting story about him dating Playmate Dorothy Stratten who was later murdered and then he went on to marry her half-sister.
  • John Larroquette on 5th & 49th. You remember him from Night Court.
  • Bowie Hogg, last week’s firing from NBC’s The Apprentice. He stood right in front of me when we were waiting for a table for dinner. TV must make people look smaller, cause he’s a really big guy. He must have been in town doing press for being fired. Hurry up Bowie, you’re at minute 14 and counting…