tracker issue : CF-3200369

select a category, or use search below
(searches all categories and all time range)
Title:

Persistent object can have a hashcode of null

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Jork Zijlstra / Jork Zijlstra (Jork Zijlstra)

Created: 05/29/2012

Components: ORM Support

Versions: 10.0

Failure Type: Incorrect w/Workaround

Found In Build/Fixed In Build: 9.0.1 / 287968

Priority/Frequency: Normal / Some users will encounter

Locale/System: English / Windows 7

Vote Count: 0

Problem Description:
When a persistent object has not been persisted yet the getHascode method return "null" as value.

This is because you have implemented a logic that when it is a persistent object the hashcode is the ID of the object. But when is not persisted yet to the database it has no ID.

Steps to Reproduce:
1) create a persistent object

2) create instance of persistent object, do not save it.

3) call method getHashcode() on this object

Actual Result:
value of null

Expected Result:
a hash value

Any Workarounds:

1) create an java class with the following method
public int getHashCode(Object object)
{
	return object.hashCode();
}

2) call this method
var javaLoader_obj = createObject("fly.system.JavaLoader");
var ServiceClass_obj = javaLoader_obj.getClassDefinition("java class");
ServiceClass_obj = createObject("java", "coldfusion.runtime.java.JavaProxy").init(ServiceClass_obj);
ServiceClass_obj.getHashCode(obj);

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3200369

Deployment Phase:	Release Candidate

External Customer Info:
External Company:  
External Customer Name: Jork Zijlstra
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments: