[jira] [Updated] (ISIS-487) Domain Object not validated by Isis before being sent to the database and RuntimeException handling on IsisTransactionManager

2015-10-26 Thread Dan Haywood (JIRA)

 [ 
https://issues.apache.org/jira/browse/ISIS-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dan Haywood updated ISIS-487:
-
Fix Version/s: (was: 2.0.0)
   1.14.0

> Domain Object not validated by Isis before being sent to the database and 
> RuntimeException handling on IsisTransactionManager
> -
>
> Key: ISIS-487
> URL: https://issues.apache.org/jira/browse/ISIS-487
> Project: Isis
>  Issue Type: Bug
>  Components: Core
>Affects Versions: core-1.2.0
>Reporter: Oscar Bou
>Assignee: Dan Haywood
> Fix For: 1.14.0
>
>
> see also ISIS-164
> ~~~
> Experiencing the following issues:
> 1. Domain Object not validated by Isis before being sent to the database 
> (executed within a BDD test; perhaps that's relevant).
> 2. Not sure if I could/should throw an exception on the "onFailure()" closure 
> (as the Isis transaction wouldn't be aborted).
> 3. I would expect to be able to know the Runtime Exception that has 
> originated the failure.
> I'm executing this code from inside a BDD integration test.
> I have a Domain Object that inherits from this class, which contains a 
> required "name" property:
> {code}
> public abstract class AbstractMultiTenantEntity extends
> AbstractMultiTenantObject implements MultiTenantEntity {
> /**
> * Name of this Entity.
> */
> private String name;
> @Column(allowsNull = "false")
> @Override
> @MemberOrder(sequence = "0.1")
> public String getName() {
> return this.name;
> }
> @Override
> public void setName(final String name) {
> this.name = name;
> }
> public String validateName(final String name) {
> if (name == null) {
> return "Name cannot be an empty string";
> } else {
> return null;
> }
> }
> ...
> }
> {code}
> The Domain Object class is declared simply as:
> {code}
> public class Risk extends AbstractMultiTenantEntity {
> ...
> }
> {code}
> I have a factory method like this one:
> {code}
> public Risk addQuantitativeRiskToAsset(...) {
> 
> // Here the "name" field is null.
> this.persist(risk);
> return risk;
> }
> {code}
> The point is that, due to a "programming error", I was not initializing the 
> "name" field (it was null). But this could happen also on other use cases.
> But the main problem is that, when the this.persist(risk) method is executed, 
> the INSERT SQL instruction appears in the log and a database CONSTRAINT 
> exception requiring the NAME database table field not to be NULL appears  (so 
> Isis has not previously validated the domain object and detected that the 
> "name" property was null).
> As the "database persist" is "cached", the only line appearing at the log is:
> 10:44:16,317  [DataNucleusSimplePersistAlgorithm main   INFO ]  persist 
> PojoAdapter@6ac42aea[T~~:!com.xms.framework.risk.domain.model.Risk:461a09cf-c483-4779-ae58-a1840baf6a9c,specification=Risk,version=null,pojo-toString=com.xms.framework.risk.domain.model.Risk@6ee01906,pojo-hash=#6ee01906]
> But on the first "flush()", when the persistence manager tries to insert the 
> record the following exception is showed in the log:
> -
> {code}
> 11:12:30,643  [DataNucleusSimplePersistAlgorithm main   INFO ]  persist 
> PojoAdapter@6d70c116[T~~:!com.xms.framework.risk.domain.model.Risk:bff8097b-72d9-40e1-b6de-aab8f5743194,specification=Risk,version=null,pojo-toString=com.xms.framework.risk.domain.model.Risk@85f4d6e2,pojo-hash=#85f4d6e2]
> 11:12:30,894  [auditmain   INFO ]  2. 
> PreparedStatement.new PreparedStatement returned 
> 11:12:30,894  [auditmain   INFO ]  2. 
> Connection.prepareStatement(INSERT INTO RISK 
> (ID,"NAME",AUTOMATICNAMING,LIKELIHOOD,CODE,EVENT_EVENT_ID_OID,IMPACT,UPDATEDBYUSER,DESCRIPTION,CATEGORY_RISKCATEGORY_ID_OID,ASSET_ENTITY_ID_OID,EVENTDESCRIPTION,CONSEQUENCESDESCRIPTION,RISKREGISTER_RISKREGISTER_ID_OID,EVENTSOURCEDESCRIPTION,OWNER_BUSINESSACTOR_ID_OID,IMPACTLEVEL_IMPACTLEVEL_ID_OID,CREATEDBYUSER,TENANTID,EVENTSOURCE_EVENTSOURCE_ID_OID,LIKELIHOODLEVEL_LIKELIHOODLEVEL_ID_OID,DATECREATED,DATEUPDATED,RISKSLEADEDBYIT_VULNERABILITY_ID_OID,RISKSMODIFIED_CONTROL_ID_OID)
>  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?), 1) returned 
> net.sf.log4jdbc.PreparedStatementSpy@afe1bc5
> 11:12:30,894  [auditmain   INFO ]  2. 
> PreparedStatement.clearBatch() returned 
> 11:12:30,894  [auditmain   INFO ]  2. 
> PreparedStatement.setTimestamp(23, 2013-08-03 11:12:30.643, 
> java.util.GregorianCalendar[time=1375521135947,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Madrid",offset=360,dstSavings=360,useDaylight=true,transitions=165,lastRule=java.util.SimpleTimeZone[id=Europe/Madrid,offse

[jira] [Updated] (ISIS-487) Domain Object not validated by Isis before being sent to the database and RuntimeException handling on IsisTransactionManager

2015-10-26 Thread Dan Haywood (JIRA)

 [ 
https://issues.apache.org/jira/browse/ISIS-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dan Haywood updated ISIS-487:
-
Description: 
see also ISIS-164

~~~
Experiencing the following issues:
1. Domain Object not validated by Isis before being sent to the database 
(executed within a BDD test; perhaps that's relevant).
2. Not sure if I could/should throw an exception on the "onFailure()" closure 
(as the Isis transaction wouldn't be aborted).
3. I would expect to be able to know the Runtime Exception that has originated 
the failure.



I'm executing this code from inside a BDD integration test.


I have a Domain Object that inherits from this class, which contains a required 
"name" property:

{code}
public abstract class AbstractMultiTenantEntity extends
AbstractMultiTenantObject implements MultiTenantEntity {

/**
* Name of this Entity.
*/
private String name;

@Column(allowsNull = "false")
@Override
@MemberOrder(sequence = "0.1")
public String getName() {
return this.name;
}

@Override
public void setName(final String name) {
this.name = name;
}

public String validateName(final String name) {
if (name == null) {
return "Name cannot be an empty string";
} else {
return null;
}
}

...
}
{code}



The Domain Object class is declared simply as:

{code}
public class Risk extends AbstractMultiTenantEntity {

...

}

{code}

I have a factory method like this one:

{code}
public Risk addQuantitativeRiskToAsset(...) {



// Here the "name" field is null.
this.persist(risk);
return risk;
}
{code}



The point is that, due to a "programming error", I was not initializing the 
"name" field (it was null). But this could happen also on other use cases.

But the main problem is that, when the this.persist(risk) method is executed, 
the INSERT SQL instruction appears in the log and a database CONSTRAINT 
exception requiring the NAME database table field not to be NULL appears  (so 
Isis has not previously validated the domain object and detected that the 
"name" property was null).



As the "database persist" is "cached", the only line appearing at the log is:


10:44:16,317  [DataNucleusSimplePersistAlgorithm main   INFO ]  persist 
PojoAdapter@6ac42aea[T~~:!com.xms.framework.risk.domain.model.Risk:461a09cf-c483-4779-ae58-a1840baf6a9c,specification=Risk,version=null,pojo-toString=com.xms.framework.risk.domain.model.Risk@6ee01906,pojo-hash=#6ee01906]


But on the first "flush()", when the persistence manager tries to insert the 
record the following exception is showed in the log:


-

{code}
11:12:30,643  [DataNucleusSimplePersistAlgorithm main   INFO ]  persist 
PojoAdapter@6d70c116[T~~:!com.xms.framework.risk.domain.model.Risk:bff8097b-72d9-40e1-b6de-aab8f5743194,specification=Risk,version=null,pojo-toString=com.xms.framework.risk.domain.model.Risk@85f4d6e2,pojo-hash=#85f4d6e2]
11:12:30,894  [auditmain   INFO ]  2. PreparedStatement.new 
PreparedStatement returned 
11:12:30,894  [auditmain   INFO ]  2. 
Connection.prepareStatement(INSERT INTO RISK 
(ID,"NAME",AUTOMATICNAMING,LIKELIHOOD,CODE,EVENT_EVENT_ID_OID,IMPACT,UPDATEDBYUSER,DESCRIPTION,CATEGORY_RISKCATEGORY_ID_OID,ASSET_ENTITY_ID_OID,EVENTDESCRIPTION,CONSEQUENCESDESCRIPTION,RISKREGISTER_RISKREGISTER_ID_OID,EVENTSOURCEDESCRIPTION,OWNER_BUSINESSACTOR_ID_OID,IMPACTLEVEL_IMPACTLEVEL_ID_OID,CREATEDBYUSER,TENANTID,EVENTSOURCE_EVENTSOURCE_ID_OID,LIKELIHOODLEVEL_LIKELIHOODLEVEL_ID_OID,DATECREATED,DATEUPDATED,RISKSLEADEDBYIT_VULNERABILITY_ID_OID,RISKSMODIFIED_CONTROL_ID_OID)
 VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?), 1) returned 
net.sf.log4jdbc.PreparedStatementSpy@afe1bc5
11:12:30,894  [auditmain   INFO ]  2. 
PreparedStatement.clearBatch() returned 
11:12:30,894  [auditmain   INFO ]  2. 
PreparedStatement.setTimestamp(23, 2013-08-03 11:12:30.643, 
java.util.GregorianCalendar[time=1375521135947,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Madrid",offset=360,dstSavings=360,useDaylight=true,transitions=165,lastRule=java.util.SimpleTimeZone[id=Europe/Madrid,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=360,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=360,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2013,MONTH=7,WEEK_OF_YEAR=31,WEEK_OF_MONTH=1,DAY_OF_MONTH=3,DAY_OF_YEAR=215,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=11,HOUR_OF_DAY=11,MINUTE=12,SECOND=15,MILLISECOND=947,ZONE_OFFSET=360,DST_OFFSET=360])
 returned 
11:12:30,895  [auditmain   INFO ]  2. 
PreparedStatement.setTimestamp(22, 2013-08-03 11:12:30.643, 
java.util.GregorianCalendar[time=1375521135947,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.Zon

[jira] [Updated] (ISIS-487) Domain Object not validated by Isis before being sent to the database and RuntimeException handling on IsisTransactionManager

2014-09-26 Thread Jeroen van der Wal (JIRA)

 [ 
https://issues.apache.org/jira/browse/ISIS-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jeroen van der Wal updated ISIS-487:

Description: 
Experiencing the following issues:
1. Domain Object not validated by Isis before being sent to the database 
(executed within a BDD test; perhaps that's relevant).
2. Not sure if I could/should throw an exception on the "onFailure()" closure 
(as the Isis transaction wouldn't be aborted).
3. I would expect to be able to know the Runtime Exception that has originated 
the failure.



I'm executing this code from inside a BDD integration test.


I have a Domain Object that inherits from this class, which contains a required 
"name" property:

{code}
public abstract class AbstractMultiTenantEntity extends
AbstractMultiTenantObject implements MultiTenantEntity {

/**
* Name of this Entity.
*/
private String name;

@Column(allowsNull = "false")
@Override
@MemberOrder(sequence = "0.1")
public String getName() {
return this.name;
}

@Override
public void setName(final String name) {
this.name = name;
}

public String validateName(final String name) {
if (name == null) {
return "Name cannot be an empty string";
} else {
return null;
}
}

...
}
{code}



The Domain Object class is declared simply as:

{code}
public class Risk extends AbstractMultiTenantEntity {

...

}

{code}

I have a factory method like this one:

{code}
public Risk addQuantitativeRiskToAsset(...) {



// Here the "name" field is null.
this.persist(risk);
return risk;
}
{code}



The point is that, due to a "programming error", I was not initializing the 
"name" field (it was null). But this could happen also on other use cases.

But the main problem is that, when the this.persist(risk) method is executed, 
the INSERT SQL instruction appears in the log and a database CONSTRAINT 
exception requiring the NAME database table field not to be NULL appears  (so 
Isis has not previously validated the domain object and detected that the 
"name" property was null).



As the "database persist" is "cached", the only line appearing at the log is:


10:44:16,317  [DataNucleusSimplePersistAlgorithm main   INFO ]  persist 
PojoAdapter@6ac42aea[T~~:!com.xms.framework.risk.domain.model.Risk:461a09cf-c483-4779-ae58-a1840baf6a9c,specification=Risk,version=null,pojo-toString=com.xms.framework.risk.domain.model.Risk@6ee01906,pojo-hash=#6ee01906]


But on the first "flush()", when the persistence manager tries to insert the 
record the following exception is showed in the log:


-

{code}
11:12:30,643  [DataNucleusSimplePersistAlgorithm main   INFO ]  persist 
PojoAdapter@6d70c116[T~~:!com.xms.framework.risk.domain.model.Risk:bff8097b-72d9-40e1-b6de-aab8f5743194,specification=Risk,version=null,pojo-toString=com.xms.framework.risk.domain.model.Risk@85f4d6e2,pojo-hash=#85f4d6e2]
11:12:30,894  [auditmain   INFO ]  2. PreparedStatement.new 
PreparedStatement returned 
11:12:30,894  [auditmain   INFO ]  2. 
Connection.prepareStatement(INSERT INTO RISK 
(ID,"NAME",AUTOMATICNAMING,LIKELIHOOD,CODE,EVENT_EVENT_ID_OID,IMPACT,UPDATEDBYUSER,DESCRIPTION,CATEGORY_RISKCATEGORY_ID_OID,ASSET_ENTITY_ID_OID,EVENTDESCRIPTION,CONSEQUENCESDESCRIPTION,RISKREGISTER_RISKREGISTER_ID_OID,EVENTSOURCEDESCRIPTION,OWNER_BUSINESSACTOR_ID_OID,IMPACTLEVEL_IMPACTLEVEL_ID_OID,CREATEDBYUSER,TENANTID,EVENTSOURCE_EVENTSOURCE_ID_OID,LIKELIHOODLEVEL_LIKELIHOODLEVEL_ID_OID,DATECREATED,DATEUPDATED,RISKSLEADEDBYIT_VULNERABILITY_ID_OID,RISKSMODIFIED_CONTROL_ID_OID)
 VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?), 1) returned 
net.sf.log4jdbc.PreparedStatementSpy@afe1bc5
11:12:30,894  [auditmain   INFO ]  2. 
PreparedStatement.clearBatch() returned 
11:12:30,894  [auditmain   INFO ]  2. 
PreparedStatement.setTimestamp(23, 2013-08-03 11:12:30.643, 
java.util.GregorianCalendar[time=1375521135947,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Madrid",offset=360,dstSavings=360,useDaylight=true,transitions=165,lastRule=java.util.SimpleTimeZone[id=Europe/Madrid,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=360,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=360,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2013,MONTH=7,WEEK_OF_YEAR=31,WEEK_OF_MONTH=1,DAY_OF_MONTH=3,DAY_OF_YEAR=215,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=11,HOUR_OF_DAY=11,MINUTE=12,SECOND=15,MILLISECOND=947,ZONE_OFFSET=360,DST_OFFSET=360])
 returned 
11:12:30,895  [auditmain   INFO ]  2. 
PreparedStatement.setTimestamp(22, 2013-08-03 11:12:30.643, 
java.util.GregorianCalendar[time=1375521135947,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=

[jira] [Updated] (ISIS-487) Domain Object not validated by Isis before being sent to the database and RuntimeException handling on IsisTransactionManager

2014-09-26 Thread Jeroen van der Wal (JIRA)

 [ 
https://issues.apache.org/jira/browse/ISIS-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jeroen van der Wal updated ISIS-487:

Fix Version/s: (was: core-1.7.0)
   core-2.0.0

> Domain Object not validated by Isis before being sent to the database and 
> RuntimeException handling on IsisTransactionManager
> -
>
> Key: ISIS-487
> URL: https://issues.apache.org/jira/browse/ISIS-487
> Project: Isis
>  Issue Type: Bug
>  Components: Core
>Affects Versions: core-1.2.0
>Reporter: Oscar Bou
>Assignee: Dan Haywood
> Fix For: core-2.0.0
>
>
> Experiencing the following issues:
> 1. Domain Object not validated by Isis before being sent to the database 
> (executed within a BDD test; perhaps that's relevant).
> 2. Not sure if I could/should throw an exception on the "onFailure()" closure 
> (as the Isis transaction wouldn't be aborted).
> 3. I would expect to be able to know the Runtime Exception that has 
> originated the failure.
> I'm executing this code from inside a BDD integration test.
> I have a Domain Object that inherits from this class, which contains a 
> required "name" property:
> public abstract class AbstractMultiTenantEntity extends
> AbstractMultiTenantObject implements MultiTenantEntity {
> /**
> * Name of this Entity.
> */
> private String name;
> @Column(allowsNull = "false")
> @Override
> @MemberOrder(sequence = "0.1")
> public String getName() {
> return this.name;
> }
> @Override
> public void setName(final String name) {
> this.name = name;
> }
> public String validateName(final String name) {
> if (name == null) {
> return "Name cannot be an empty string";
> } else {
> return null;
> }
> }
> ...
> }
> The Domain Object class is declared simply as:
> public class Risk extends AbstractMultiTenantEntity {
> ...
> }
> I have a factory method like this one:
> public Risk addQuantitativeRiskToAsset(...) {
> 
> // Here the "name" field is null.
> this.persist(risk);
> return risk;
> }
> The point is that, due to a "programming error", I was not initializing the 
> "name" field (it was null). But this could happen also on other use cases.
> But the main problem is that, when the this.persist(risk) method is executed, 
> the INSERT SQL instruction appears in the log and a database CONSTRAINT 
> exception requiring the NAME database table field not to be NULL appears  (so 
> Isis has not previously validated the domain object and detected that the 
> "name" property was null).
> As the "database persist" is "cached", the only line appearing at the log is:
> 10:44:16,317  [DataNucleusSimplePersistAlgorithm main   INFO ]  persist 
> PojoAdapter@6ac42aea[T~~:!com.xms.framework.risk.domain.model.Risk:461a09cf-c483-4779-ae58-a1840baf6a9c,specification=Risk,version=null,pojo-toString=com.xms.framework.risk.domain.model.Risk@6ee01906,pojo-hash=#6ee01906]
> But on the first "flush()", when the persistence manager tries to insert the 
> record the following exception is showed in the log:
> -
> 11:12:30,643  [DataNucleusSimplePersistAlgorithm main   INFO ]  persist 
> PojoAdapter@6d70c116[T~~:!com.xms.framework.risk.domain.model.Risk:bff8097b-72d9-40e1-b6de-aab8f5743194,specification=Risk,version=null,pojo-toString=com.xms.framework.risk.domain.model.Risk@85f4d6e2,pojo-hash=#85f4d6e2]
> 11:12:30,894  [auditmain   INFO ]  2. 
> PreparedStatement.new PreparedStatement returned 
> 11:12:30,894  [auditmain   INFO ]  2. 
> Connection.prepareStatement(INSERT INTO RISK 
> (ID,"NAME",AUTOMATICNAMING,LIKELIHOOD,CODE,EVENT_EVENT_ID_OID,IMPACT,UPDATEDBYUSER,DESCRIPTION,CATEGORY_RISKCATEGORY_ID_OID,ASSET_ENTITY_ID_OID,EVENTDESCRIPTION,CONSEQUENCESDESCRIPTION,RISKREGISTER_RISKREGISTER_ID_OID,EVENTSOURCEDESCRIPTION,OWNER_BUSINESSACTOR_ID_OID,IMPACTLEVEL_IMPACTLEVEL_ID_OID,CREATEDBYUSER,TENANTID,EVENTSOURCE_EVENTSOURCE_ID_OID,LIKELIHOODLEVEL_LIKELIHOODLEVEL_ID_OID,DATECREATED,DATEUPDATED,RISKSLEADEDBYIT_VULNERABILITY_ID_OID,RISKSMODIFIED_CONTROL_ID_OID)
>  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?), 1) returned 
> net.sf.log4jdbc.PreparedStatementSpy@afe1bc5
> 11:12:30,894  [auditmain   INFO ]  2. 
> PreparedStatement.clearBatch() returned 
> 11:12:30,894  [auditmain   INFO ]  2. 
> PreparedStatement.setTimestamp(23, 2013-08-03 11:12:30.643, 
> java.util.GregorianCalendar[time=1375521135947,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Madrid",offset=360,dstSavings=360,useDaylight=true,transitions=165,lastRule=java.util.SimpleTimeZone[id=Europe/Madrid,offset=360,dstSavings=360,useDaylight=true,startYear=0,star

[jira] [Updated] (ISIS-487) Domain Object not validated by Isis before being sent to the database and RuntimeException handling on IsisTransactionManager

2014-02-27 Thread Dan Haywood (JIRA)

 [ 
https://issues.apache.org/jira/browse/ISIS-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dan Haywood updated ISIS-487:
-

Fix Version/s: (was: core-1.4.0)
   core-1.5.0

> Domain Object not validated by Isis before being sent to the database and 
> RuntimeException handling on IsisTransactionManager
> -
>
> Key: ISIS-487
> URL: https://issues.apache.org/jira/browse/ISIS-487
> Project: Isis
>  Issue Type: Bug
>  Components: Core
>Affects Versions: core-1.2.0
>Reporter: Oscar Bou
>Assignee: Dan Haywood
> Fix For: core-1.5.0
>
>
> Experiencing the following issues:
> 1. Domain Object not validated by Isis before being sent to the database 
> (executed within a BDD test; perhaps that's relevant).
> 2. Not sure if I could/should throw an exception on the "onFailure()" closure 
> (as the Isis transaction wouldn't be aborted).
> 3. I would expect to be able to know the Runtime Exception that has 
> originated the failure.
> I'm executing this code from inside a BDD integration test.
> I have a Domain Object that inherits from this class, which contains a 
> required "name" property:
> public abstract class AbstractMultiTenantEntity extends
> AbstractMultiTenantObject implements MultiTenantEntity {
> /**
> * Name of this Entity.
> */
> private String name;
> @Column(allowsNull = "false")
> @Override
> @MemberOrder(sequence = "0.1")
> public String getName() {
> return this.name;
> }
> @Override
> public void setName(final String name) {
> this.name = name;
> }
> public String validateName(final String name) {
> if (name == null) {
> return "Name cannot be an empty string";
> } else {
> return null;
> }
> }
> ...
> }
> The Domain Object class is declared simply as:
> public class Risk extends AbstractMultiTenantEntity {
> ...
> }
> I have a factory method like this one:
> public Risk addQuantitativeRiskToAsset(...) {
> 
> // Here the "name" field is null.
> this.persist(risk);
> return risk;
> }
> The point is that, due to a "programming error", I was not initializing the 
> "name" field (it was null). But this could happen also on other use cases.
> But the main problem is that, when the this.persist(risk) method is executed, 
> the INSERT SQL instruction appears in the log and a database CONSTRAINT 
> exception requiring the NAME database table field not to be NULL appears  (so 
> Isis has not previously validated the domain object and detected that the 
> "name" property was null).
> As the "database persist" is "cached", the only line appearing at the log is:
> 10:44:16,317  [DataNucleusSimplePersistAlgorithm main   INFO ]  persist 
> PojoAdapter@6ac42aea[T~~:!com.xms.framework.risk.domain.model.Risk:461a09cf-c483-4779-ae58-a1840baf6a9c,specification=Risk,version=null,pojo-toString=com.xms.framework.risk.domain.model.Risk@6ee01906,pojo-hash=#6ee01906]
> But on the first "flush()", when the persistence manager tries to insert the 
> record the following exception is showed in the log:
> -
> 11:12:30,643  [DataNucleusSimplePersistAlgorithm main   INFO ]  persist 
> PojoAdapter@6d70c116[T~~:!com.xms.framework.risk.domain.model.Risk:bff8097b-72d9-40e1-b6de-aab8f5743194,specification=Risk,version=null,pojo-toString=com.xms.framework.risk.domain.model.Risk@85f4d6e2,pojo-hash=#85f4d6e2]
> 11:12:30,894  [auditmain   INFO ]  2. 
> PreparedStatement.new PreparedStatement returned 
> 11:12:30,894  [auditmain   INFO ]  2. 
> Connection.prepareStatement(INSERT INTO RISK 
> (ID,"NAME",AUTOMATICNAMING,LIKELIHOOD,CODE,EVENT_EVENT_ID_OID,IMPACT,UPDATEDBYUSER,DESCRIPTION,CATEGORY_RISKCATEGORY_ID_OID,ASSET_ENTITY_ID_OID,EVENTDESCRIPTION,CONSEQUENCESDESCRIPTION,RISKREGISTER_RISKREGISTER_ID_OID,EVENTSOURCEDESCRIPTION,OWNER_BUSINESSACTOR_ID_OID,IMPACTLEVEL_IMPACTLEVEL_ID_OID,CREATEDBYUSER,TENANTID,EVENTSOURCE_EVENTSOURCE_ID_OID,LIKELIHOODLEVEL_LIKELIHOODLEVEL_ID_OID,DATECREATED,DATEUPDATED,RISKSLEADEDBYIT_VULNERABILITY_ID_OID,RISKSMODIFIED_CONTROL_ID_OID)
>  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?), 1) returned 
> net.sf.log4jdbc.PreparedStatementSpy@afe1bc5
> 11:12:30,894  [auditmain   INFO ]  2. 
> PreparedStatement.clearBatch() returned 
> 11:12:30,894  [auditmain   INFO ]  2. 
> PreparedStatement.setTimestamp(23, 2013-08-03 11:12:30.643, 
> java.util.GregorianCalendar[time=1375521135947,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Madrid",offset=360,dstSavings=360,useDaylight=true,transitions=165,lastRule=java.util.SimpleTimeZone[id=Europe/Madrid,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,start

[jira] [Updated] (ISIS-487) Domain Object not validated by Isis before being sent to the database and RuntimeException handling on IsisTransactionManager

2013-09-16 Thread Dan Haywood (JIRA)

 [ 
https://issues.apache.org/jira/browse/ISIS-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dan Haywood updated ISIS-487:
-

Fix Version/s: (was: core-1.3.0)
   core-1.4.0

> Domain Object not validated by Isis before being sent to the database and 
> RuntimeException handling on IsisTransactionManager
> -
>
> Key: ISIS-487
> URL: https://issues.apache.org/jira/browse/ISIS-487
> Project: Isis
>  Issue Type: Bug
>  Components: Core
>Affects Versions: core-1.2.0
>Reporter: Oscar Bou
>Assignee: Dan Haywood
> Fix For: core-1.4.0
>
>
> Experiencing the following issues:
> 1. Domain Object not validated by Isis before being sent to the database 
> (executed within a BDD test; perhaps that's relevant).
> 2. Not sure if I could/should throw an exception on the "onFailure()" closure 
> (as the Isis transaction wouldn't be aborted).
> 3. I would expect to be able to know the Runtime Exception that has 
> originated the failure.
> I'm executing this code from inside a BDD integration test.
> I have a Domain Object that inherits from this class, which contains a 
> required "name" property:
> public abstract class AbstractMultiTenantEntity extends
> AbstractMultiTenantObject implements MultiTenantEntity {
> /**
> * Name of this Entity.
> */
> private String name;
> @Column(allowsNull = "false")
> @Override
> @MemberOrder(sequence = "0.1")
> public String getName() {
> return this.name;
> }
> @Override
> public void setName(final String name) {
> this.name = name;
> }
> public String validateName(final String name) {
> if (name == null) {
> return "Name cannot be an empty string";
> } else {
> return null;
> }
> }
> ...
> }
> The Domain Object class is declared simply as:
> public class Risk extends AbstractMultiTenantEntity {
> ...
> }
> I have a factory method like this one:
> public Risk addQuantitativeRiskToAsset(...) {
> 
> // Here the "name" field is null.
> this.persist(risk);
> return risk;
> }
> The point is that, due to a "programming error", I was not initializing the 
> "name" field (it was null). But this could happen also on other use cases.
> But the main problem is that, when the this.persist(risk) method is executed, 
> the INSERT SQL instruction appears in the log and a database CONSTRAINT 
> exception requiring the NAME database table field not to be NULL appears  (so 
> Isis has not previously validated the domain object and detected that the 
> "name" property was null).
> As the "database persist" is "cached", the only line appearing at the log is:
> 10:44:16,317  [DataNucleusSimplePersistAlgorithm main   INFO ]  persist 
> PojoAdapter@6ac42aea[T~~:!com.xms.framework.risk.domain.model.Risk:461a09cf-c483-4779-ae58-a1840baf6a9c,specification=Risk,version=null,pojo-toString=com.xms.framework.risk.domain.model.Risk@6ee01906,pojo-hash=#6ee01906]
> But on the first "flush()", when the persistence manager tries to insert the 
> record the following exception is showed in the log:
> -
> 11:12:30,643  [DataNucleusSimplePersistAlgorithm main   INFO ]  persist 
> PojoAdapter@6d70c116[T~~:!com.xms.framework.risk.domain.model.Risk:bff8097b-72d9-40e1-b6de-aab8f5743194,specification=Risk,version=null,pojo-toString=com.xms.framework.risk.domain.model.Risk@85f4d6e2,pojo-hash=#85f4d6e2]
> 11:12:30,894  [auditmain   INFO ]  2. 
> PreparedStatement.new PreparedStatement returned 
> 11:12:30,894  [auditmain   INFO ]  2. 
> Connection.prepareStatement(INSERT INTO RISK 
> (ID,"NAME",AUTOMATICNAMING,LIKELIHOOD,CODE,EVENT_EVENT_ID_OID,IMPACT,UPDATEDBYUSER,DESCRIPTION,CATEGORY_RISKCATEGORY_ID_OID,ASSET_ENTITY_ID_OID,EVENTDESCRIPTION,CONSEQUENCESDESCRIPTION,RISKREGISTER_RISKREGISTER_ID_OID,EVENTSOURCEDESCRIPTION,OWNER_BUSINESSACTOR_ID_OID,IMPACTLEVEL_IMPACTLEVEL_ID_OID,CREATEDBYUSER,TENANTID,EVENTSOURCE_EVENTSOURCE_ID_OID,LIKELIHOODLEVEL_LIKELIHOODLEVEL_ID_OID,DATECREATED,DATEUPDATED,RISKSLEADEDBYIT_VULNERABILITY_ID_OID,RISKSMODIFIED_CONTROL_ID_OID)
>  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?), 1) returned 
> net.sf.log4jdbc.PreparedStatementSpy@afe1bc5
> 11:12:30,894  [auditmain   INFO ]  2. 
> PreparedStatement.clearBatch() returned 
> 11:12:30,894  [auditmain   INFO ]  2. 
> PreparedStatement.setTimestamp(23, 2013-08-03 11:12:30.643, 
> java.util.GregorianCalendar[time=1375521135947,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Madrid",offset=360,dstSavings=360,useDaylight=true,transitions=165,lastRule=java.util.SimpleTimeZone[id=Europe/Madrid,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,s

[jira] [Updated] (ISIS-487) Domain Object not validated by Isis before being sent to the database and RuntimeException handling on IsisTransactionManager

2013-08-19 Thread Dan Haywood (JIRA)

 [ 
https://issues.apache.org/jira/browse/ISIS-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dan Haywood updated ISIS-487:
-

Component/s: Core

> Domain Object not validated by Isis before being sent to the database and 
> RuntimeException handling on IsisTransactionManager
> -
>
> Key: ISIS-487
> URL: https://issues.apache.org/jira/browse/ISIS-487
> Project: Isis
>  Issue Type: Bug
>  Components: Core
>Affects Versions: core-1.2.0
>Reporter: Oscar Bou
>Assignee: Dan Haywood
>
> Experiencing the following issues:
> 1. Domain Object not validated by Isis before being sent to the database 
> (executed within a BDD test; perhaps that's relevant).
> 2. Not sure if I could/should throw an exception on the "onFailure()" closure 
> (as the Isis transaction wouldn't be aborted).
> 3. I would expect to be able to know the Runtime Exception that has 
> originated the failure.
> I'm executing this code from inside a BDD integration test.
> I have a Domain Object that inherits from this class, which contains a 
> required "name" property:
> public abstract class AbstractMultiTenantEntity extends
> AbstractMultiTenantObject implements MultiTenantEntity {
> /**
> * Name of this Entity.
> */
> private String name;
> @Column(allowsNull = "false")
> @Override
> @MemberOrder(sequence = "0.1")
> public String getName() {
> return this.name;
> }
> @Override
> public void setName(final String name) {
> this.name = name;
> }
> public String validateName(final String name) {
> if (name == null) {
> return "Name cannot be an empty string";
> } else {
> return null;
> }
> }
> ...
> }
> The Domain Object class is declared simply as:
> public class Risk extends AbstractMultiTenantEntity {
> ...
> }
> I have a factory method like this one:
> public Risk addQuantitativeRiskToAsset(...) {
> 
> // Here the "name" field is null.
> this.persist(risk);
> return risk;
> }
> The point is that, due to a "programming error", I was not initializing the 
> "name" field (it was null). But this could happen also on other use cases.
> But the main problem is that, when the this.persist(risk) method is executed, 
> the INSERT SQL instruction appears in the log and a database CONSTRAINT 
> exception requiring the NAME database table field not to be NULL appears  (so 
> Isis has not previously validated the domain object and detected that the 
> "name" property was null).
> As the "database persist" is "cached", the only line appearing at the log is:
> 10:44:16,317  [DataNucleusSimplePersistAlgorithm main   INFO ]  persist 
> PojoAdapter@6ac42aea[T~~:!com.xms.framework.risk.domain.model.Risk:461a09cf-c483-4779-ae58-a1840baf6a9c,specification=Risk,version=null,pojo-toString=com.xms.framework.risk.domain.model.Risk@6ee01906,pojo-hash=#6ee01906]
> But on the first "flush()", when the persistence manager tries to insert the 
> record the following exception is showed in the log:
> -
> 11:12:30,643  [DataNucleusSimplePersistAlgorithm main   INFO ]  persist 
> PojoAdapter@6d70c116[T~~:!com.xms.framework.risk.domain.model.Risk:bff8097b-72d9-40e1-b6de-aab8f5743194,specification=Risk,version=null,pojo-toString=com.xms.framework.risk.domain.model.Risk@85f4d6e2,pojo-hash=#85f4d6e2]
> 11:12:30,894  [auditmain   INFO ]  2. 
> PreparedStatement.new PreparedStatement returned 
> 11:12:30,894  [auditmain   INFO ]  2. 
> Connection.prepareStatement(INSERT INTO RISK 
> (ID,"NAME",AUTOMATICNAMING,LIKELIHOOD,CODE,EVENT_EVENT_ID_OID,IMPACT,UPDATEDBYUSER,DESCRIPTION,CATEGORY_RISKCATEGORY_ID_OID,ASSET_ENTITY_ID_OID,EVENTDESCRIPTION,CONSEQUENCESDESCRIPTION,RISKREGISTER_RISKREGISTER_ID_OID,EVENTSOURCEDESCRIPTION,OWNER_BUSINESSACTOR_ID_OID,IMPACTLEVEL_IMPACTLEVEL_ID_OID,CREATEDBYUSER,TENANTID,EVENTSOURCE_EVENTSOURCE_ID_OID,LIKELIHOODLEVEL_LIKELIHOODLEVEL_ID_OID,DATECREATED,DATEUPDATED,RISKSLEADEDBYIT_VULNERABILITY_ID_OID,RISKSMODIFIED_CONTROL_ID_OID)
>  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?), 1) returned 
> net.sf.log4jdbc.PreparedStatementSpy@afe1bc5
> 11:12:30,894  [auditmain   INFO ]  2. 
> PreparedStatement.clearBatch() returned 
> 11:12:30,894  [auditmain   INFO ]  2. 
> PreparedStatement.setTimestamp(23, 2013-08-03 11:12:30.643, 
> java.util.GregorianCalendar[time=1375521135947,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Madrid",offset=360,dstSavings=360,useDaylight=true,transitions=165,lastRule=java.util.SimpleTimeZone[id=Europe/Madrid,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=360,startTimeMode=2,endMode=2,

[jira] [Updated] (ISIS-487) Domain Object not validated by Isis before being sent to the database and RuntimeException handling on IsisTransactionManager

2013-08-19 Thread Dan Haywood (JIRA)

 [ 
https://issues.apache.org/jira/browse/ISIS-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dan Haywood updated ISIS-487:
-

Fix Version/s: core-1.3.0

> Domain Object not validated by Isis before being sent to the database and 
> RuntimeException handling on IsisTransactionManager
> -
>
> Key: ISIS-487
> URL: https://issues.apache.org/jira/browse/ISIS-487
> Project: Isis
>  Issue Type: Bug
>  Components: Core
>Affects Versions: core-1.2.0
>Reporter: Oscar Bou
>Assignee: Dan Haywood
> Fix For: core-1.3.0
>
>
> Experiencing the following issues:
> 1. Domain Object not validated by Isis before being sent to the database 
> (executed within a BDD test; perhaps that's relevant).
> 2. Not sure if I could/should throw an exception on the "onFailure()" closure 
> (as the Isis transaction wouldn't be aborted).
> 3. I would expect to be able to know the Runtime Exception that has 
> originated the failure.
> I'm executing this code from inside a BDD integration test.
> I have a Domain Object that inherits from this class, which contains a 
> required "name" property:
> public abstract class AbstractMultiTenantEntity extends
> AbstractMultiTenantObject implements MultiTenantEntity {
> /**
> * Name of this Entity.
> */
> private String name;
> @Column(allowsNull = "false")
> @Override
> @MemberOrder(sequence = "0.1")
> public String getName() {
> return this.name;
> }
> @Override
> public void setName(final String name) {
> this.name = name;
> }
> public String validateName(final String name) {
> if (name == null) {
> return "Name cannot be an empty string";
> } else {
> return null;
> }
> }
> ...
> }
> The Domain Object class is declared simply as:
> public class Risk extends AbstractMultiTenantEntity {
> ...
> }
> I have a factory method like this one:
> public Risk addQuantitativeRiskToAsset(...) {
> 
> // Here the "name" field is null.
> this.persist(risk);
> return risk;
> }
> The point is that, due to a "programming error", I was not initializing the 
> "name" field (it was null). But this could happen also on other use cases.
> But the main problem is that, when the this.persist(risk) method is executed, 
> the INSERT SQL instruction appears in the log and a database CONSTRAINT 
> exception requiring the NAME database table field not to be NULL appears  (so 
> Isis has not previously validated the domain object and detected that the 
> "name" property was null).
> As the "database persist" is "cached", the only line appearing at the log is:
> 10:44:16,317  [DataNucleusSimplePersistAlgorithm main   INFO ]  persist 
> PojoAdapter@6ac42aea[T~~:!com.xms.framework.risk.domain.model.Risk:461a09cf-c483-4779-ae58-a1840baf6a9c,specification=Risk,version=null,pojo-toString=com.xms.framework.risk.domain.model.Risk@6ee01906,pojo-hash=#6ee01906]
> But on the first "flush()", when the persistence manager tries to insert the 
> record the following exception is showed in the log:
> -
> 11:12:30,643  [DataNucleusSimplePersistAlgorithm main   INFO ]  persist 
> PojoAdapter@6d70c116[T~~:!com.xms.framework.risk.domain.model.Risk:bff8097b-72d9-40e1-b6de-aab8f5743194,specification=Risk,version=null,pojo-toString=com.xms.framework.risk.domain.model.Risk@85f4d6e2,pojo-hash=#85f4d6e2]
> 11:12:30,894  [auditmain   INFO ]  2. 
> PreparedStatement.new PreparedStatement returned 
> 11:12:30,894  [auditmain   INFO ]  2. 
> Connection.prepareStatement(INSERT INTO RISK 
> (ID,"NAME",AUTOMATICNAMING,LIKELIHOOD,CODE,EVENT_EVENT_ID_OID,IMPACT,UPDATEDBYUSER,DESCRIPTION,CATEGORY_RISKCATEGORY_ID_OID,ASSET_ENTITY_ID_OID,EVENTDESCRIPTION,CONSEQUENCESDESCRIPTION,RISKREGISTER_RISKREGISTER_ID_OID,EVENTSOURCEDESCRIPTION,OWNER_BUSINESSACTOR_ID_OID,IMPACTLEVEL_IMPACTLEVEL_ID_OID,CREATEDBYUSER,TENANTID,EVENTSOURCE_EVENTSOURCE_ID_OID,LIKELIHOODLEVEL_LIKELIHOODLEVEL_ID_OID,DATECREATED,DATEUPDATED,RISKSLEADEDBYIT_VULNERABILITY_ID_OID,RISKSMODIFIED_CONTROL_ID_OID)
>  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?), 1) returned 
> net.sf.log4jdbc.PreparedStatementSpy@afe1bc5
> 11:12:30,894  [auditmain   INFO ]  2. 
> PreparedStatement.clearBatch() returned 
> 11:12:30,894  [auditmain   INFO ]  2. 
> PreparedStatement.setTimestamp(23, 2013-08-03 11:12:30.643, 
> java.util.GregorianCalendar[time=1375521135947,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Madrid",offset=360,dstSavings=360,useDaylight=true,transitions=165,lastRule=java.util.SimpleTimeZone[id=Europe/Madrid,offset=360,dstSavings=360,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,