Pencils Down

This weblog is about my experiences in software development

Browsing Posts published in March, 2009

If you are attempting to delete an object that is part of a parent object collection you are likely to have recieved an exception that looks like:

org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade …..

You must remove the entity from any parent collection first, then delete.  For example:

entity.getParent().getCollectionOfEntities().remove(entity);

dao.delete(entity);

It would be nice if Hibernate just figured this out, but I don’t think that kind of oversight is coded into the toolset.

You may have recieved an exception in Hibernate like:

org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session…..

This is likely caused by your code doing something like:

session.get()

object.setSomething(value)

session.update()

The session.update() call is attempting to attach an object to the Hibernate session.  This is done by the object id.  If you already have an object with the same id associated with the session (i.e. maintained by Hibernate) you get this error.

You have two choices:

1) Don’t call update on the object.  It is already being maintained by Hibernate.  There is no need to do so.  A later flush() will push any changes recorded in the session to the database.

2) If you can not tell if the object is associated with the session (likely in a long user scenario) call merge() instead.  Merge() takes the instance passed and merges it with any object of the same id associated with the session.  Note, if you plan on using the object again you must use the object returned by the call to merge().  The instance object passed to merge will not be updated.

Someone I know has been working on a death march project.  Management has refused to listen to reason.  Expectation of producing many thousands of lines of code per developer per week.  Team members attempting to jump ship before the death bell tolls.  Team members (developers) forced to sit through grueling team status meetings (in the light of these absurd delivery dates).  Really a very illogical situation.

Then I talked to a manager at another company.  The manager thinks they are ‘just’ setting up the subcontractor on the project to take a fall.  The upper management view of the project is that everything is rosy, on-time, on-budget, happy people.  But the bad subcontractor is not producing on time, budget, quality level per contract.  Yes, technically, the sub has been amiss.  Guess where all the fingers will be pointing when the delivery time slides on by without anything to show?  Once the sub is replaced then everything can be re-scheduled, budgeted, aligned, etc… 

I wonder how many times you can do that before upper management figures out where the problem really is?

The column referenced in the jspx file,

<f:facet name="header">
<ice:commandSortHeader
columnName="DEF"
arrow="true" >
<ice:outputLabel value="D-E-F" />
</ice:commandSortHeader>
</f:facet>

must much the column name in the backing bean,

xtable = new CheckBoxTable();
...
xtable.setColumnNames(new String[] { "ABC", "DEF"});

You must specify a column width for this to work:

... style="width:20px; text-align:center"...

Our team lead just hired another contractor from the same agency I am working through.  The contractor went through the interview rounds (full-time’s only) including the team lead and group lead.

Per the team lead the developer has lots of experience with Java, JSF, SOA, etc…  All the stuff we need on the team

The guy talks, a lot.  This is just a personality trait that irks me.  So, maybe he’s ok anyway.

Then I overhear the conversations he’s having with other developers (see talks a lot above) and some of the questions he has asked me:

  • When a screen (from the functional spec) has multiple checkboxes does that mean the user can select multiple items?
  • Similar when a screen has multiple radio buttons does that mean the user can select only one?
  • Do I need the JDK installed to compile the application?
  • Are all of the user actions affecting the database?

I guess the worst part is I bet he is getting the same hourly rate (or better) than I am.

I work at a large defense contractor.  There are two levels of shareware licensing that need to be addressed for any product that is used:

1) Will the product be used in the field, in a production environment?

2) Will the product be used on the corporate LAN?

Any new product has to go through a rigorous review by legal staff to review the exact license involved in a product.  They are looking for the clause that says “We own your company after 12 days of use”.  Surprisingly, there are some open licenses that have such clauses.  Pretty gutsy – just count on coders not actually reading the legaleeze.

Use on the LAN means the product must also be reviewed for security breaches.  While a defense contractor has real security levels that conform to government standards, I think this is a reasonable test for any corporate tool.  Again, some products fail the security test by either including silliness (such as Google toolbar poking back at google.com on a regular basis) or outright virus/spam.

Use in production means the software will reside on a defense product in the field.  Whole new levels of pain to evaluate the product for holes.  Not surprisingly, there is a lot of Not Invented Here coding that goes on just to avoid such a review.