This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Randy Scarberry

Greenhorn
+ Follow
since May 15, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Randy Scarberry

BTW, I've been conducting lots of interviews lately. I just might use that question next time. If anyone gives Cameron's response, I think I'll chase him/her to the parking lot, drag him/her back in, and make sure he/she gets hired.

(We really need a neuter pronoun in the English language.)


10 years ago
Sounds like what he was asking was: "Why would you bother with interfaces if Java supported multiple inheritance?" Well, interfaces weren't devised only to make up for Java's lack of multiple class inheritance. An interface defines the software contract, not the implementation. Interfaces give you the flexibility of doing the same things in any way you can conceive, as long as each way satisfies the contract.
10 years ago
Well, turned out that this was a very simple problem... I forgot to precede "id" in setId() with "this". So setId(Long id) didn't actually do a thing.

When I run the example from Cameron McKenzie's book, the User objects are successfully added to the database, but I get the stack shown below. As you can see, this was from the seventh run. Looks like after the commit, the DefaultFlushEntityEventListener looks at the id of the User object, sees that it's still the default null value, and complains.

I'm using hibernate 3.5.2-Final set up with a maven project. I won't post my pom.xml just yet, since I'm hoping this turns out to be something simple to fix.

Randy




This is a snippet of code from the program. The trace is triggered by the commit on line 17.