Matt RaibleMatt Raible is a Web Developer and Java Champion. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

Hibernate Help Needed

I'll try the approach that Lance used to solve my Hibernate problem. First, I'll explain the problem. In two days, if I haven't solved it - I'll bash on Hibernate and say it s***s (can't do it yet - right ;-), and then I'll claim it rocks once I get my problem solved. Hmmm, it took Lance 4 days - I have 3 before my deadline (Thursday). Luckily, I know of workarounds already (I just want to do things the recommended way) - therefore, I should never have to bash on Hibernate.

My problem is basically that I have a Parent object and it has a one-to-many relationship to a Child object. This is usually a very simple thing to configure in a Parent.hbm.xml file. To make things complicated, my Child object has a composite-id which is another class. I can retrieve information just fine, but when I try to save the Parent, Hibernate tries to insert a new Child. Here's the message I sent to the hibernate-devel mailing list:

** all classes extend from BaseObject with has equals(), 
   hashCode() and toString() methods.

Parent.java
---
private Long id;
private List children;
+appropriate getters/setters

Parent.hbm.xml
---
<bag role="children" table="CHILDREN" cascade="all">
    <key column="parent_id" length="22"/>
    <one-to-many class="eg.Child"/>
</bag>

Child.java
---
private ChildId id;
+appropriate getter/setter

ChildId.java
---
private Long parentId;
private Long recordNum;
+ appropriate getter/setters

Child.hbm.xml
---
<composite-id name="id"
    class="eg.ChildId"
    unsaved-value="none">
    <key-property column="parent_id" length="22" 
        name="parentId" type="long"/>
    <key-property column="record_num" length="22" 
        name="recordNum" type="long"/>
</composite-id>

I am able to retrieve children just fine, but when I try to save 
the parent, hibernate tries to do an insert and I get a unique 
constraint violation.

I'm calling the following method to save everything:

public Parent saveParent(Parent p) throws DAOException {
    storeObject(p);
    return (Parent) retrieveObject(eg.Parent.class, p.getId());
}

I got the storeObject method from one of the examples floating 
around, so it could definitely be my problem:

protected void storeObject(Object obj) throws DAOException {
    Session ses = null;

    try {
        ses = HibernateSession.currentSession();
        ses.saveOrUpdate(obj);
        ses.flush();
        ses.connection().commit();
    } catch (Exception e) {
        try {
            ses.connection().rollback();
        } catch (Exception ex) {
            e.printStackTrace();
        }

        ;
        throw new DAOException(e);
    } finally {
        try {
            HibernateSession.closeSession();
        } catch (Exception ex) {
            ex.printStackTrace();
        }

        ;
    }
}

As always, any help is greatly appreciated.

Posted in Java at Jan 20 2003, 07:17:41 PM MST 8 Comments

Phoenix Themes Galore!

I found a whole gobbly-gook of new Phoenix themes thanks to Matt Croydon. I'm going with Phoenity Aqua for now. This brings up another point - if you're using Windows and you're NOT using Phoenix, you're wasting your time - it makes browsing so much better.

Posted in The Web at Jan 20 2003, 06:47:02 AM MST Add a Comment

[ANNOUNCE] Manywhere Moblogger

moblogger logo Russ has released moblogger, which maybe exactly what I am looking for. It seems that I can use it to e-mail posts to this site.

This application runs as a background process that monitors a POP3 email account for new email, then downloads it, detaches any files such as pictures, sound or video, uses the Blogger API to post the text in the email to your blog and uses FTP to post the files to your server. Send the email from a phone and you immediately start "moblogging".
...
When you send email, put your password in the subject line!! Since the blogger API doesn't support titles, this is a good place to make sure that some random person or spammer doesn't start posting to your blog by sending an email.

That's a cool way to get around the authentication problem. I think the latest blogger API does support titles, but I definitely could be mistaken. I suppose if I were an ambitious fellow, I could do some research on the bloggerDev mailing list - but I'll pass. Unfortunately, I dig titles and while I may use Russ's tool, I'll probably still have to edit/create titles. One thing I'd like to do with Roller's Editor UI is to make is WAP compatible - since it's XHTML, I could be able to create a set of JSPs with JSTL and XSL and blowee, there's your mobUI. I don't know that I'd actually ever use it though. I rarely even make phone calls on my T68i, let alone browse the web.

Posted in Java at Jan 20 2003, 05:07:49 AM MST Add a Comment