restrictions problems followup..

1 view
Skip to first unread message

Eitan Suez

unread,
Aug 27, 2008, 11:17:33 AM8/27/08
to jmatter
hi nachos,

  following up on the issues you brought up regarding exceptions when
  setting/applying authorization restrictions on commands.

  1. you cited two specific exceptions.  the first:
org.hibernate.HibernateException: instance not of expected entity type: com.u2d.element.TypeCommand is not a: com.u2d.element.Command
  i have tracked down.  TypeCommand is a command added on a type by marking the method
  static.  i had overlooked letting hibernate know about this class, so when it had to persist
  the command in question, it threw an exception.  this is now fixed in subversion


  i have not yet reproduced the second exception:  NonUniqueObjectException.  i wonder if it might
  perhaps triggered by the first exception (above).  i will continue attempting to generate
  this same exception, and will then proceed to add a fix.

  2. you also mentioned a bug with identity fields and validation, again producing a hibernate
   exception.  i will track this one down next.

/ eitan

eitan

unread,
Aug 27, 2008, 11:54:49 AM8/27/08
to jmatter


On Aug 27, 10:17 am, "Eitan Suez" <eitan.s...@gmail.com> wrote:
> hi nachos,
>
> ...
>   2. you also mentioned a bug with identity fields and validation, again
> producing a hibernate
>    exception.  i will track this one down next.
>

you'd mentioned that attempting to save
an instance with a blank value for an identity field throws
an exception.

i just retrofitted sympster.Speaker.name to be an identity field
for testing this issue. so far i cannot reproduce. attemtping to
save is blocked by a validation error which forces me to enter
a name. subsequently saving works in this scenario.

can you give me more detail in your case? what is the type of the
identity field? can you reproduce it every time?

thanks,
/ eitan

nacho de Quilmes

unread,
Aug 27, 2008, 3:37:02 PM8/27/08
to jma...@googlegroups.com
Hi Eitan:

bug with identity fields and validation:

When I want to save an object and it has a duplicate key, the system thrwon a validation message (cannot save object: duplicate value for a unique field), which is correct; if I changed the value of the unique file and save the object, the system thrown the next message on interface: "Object has been modified by another user, please refresh the object!" (this object it isn't on the data base yet, so I can't refresh it, and it isn't appear the refresh button on the editable interface). The type of the field is TextEO (It is a String). This error always appear.

I think that the bug with the add restrictions on objects has been resolved, but I didn't prove it very well.

Thank for your help

nacho

Eitan Suez

unread,
Aug 27, 2008, 3:53:00 PM8/27/08
to jma...@googlegroups.com
thanks.  ok now i understand how to reproduce the issue with the identity field.
i just tested this in sympster with speaker.name (which is now marked as an
identity field / unique).  the error doesn't manifest itself.  so perhaps it's specific
to the case where the field is a TextEO.  will try to test that case.
what database are you using?

/ eitan

nacho de Quilmes

unread,
Aug 27, 2008, 3:58:48 PM8/27/08
to jma...@googlegroups.com
I am using Postgresql 8.3

Eitan Suez

unread,
Aug 27, 2008, 4:43:06 PM8/27/08
to jma...@googlegroups.com
ok, i am now able to reproduce this issue, using postgresql.
thanks,
/ eitan

Eitan Suez

unread,
Aug 27, 2008, 5:11:56 PM8/27/08
to jma...@googlegroups.com
ok, this should now be fixed.
/ eitan

nacho de Quilmes

unread,
Aug 27, 2008, 5:25:44 PM8/27/08
to jma...@googlegroups.com
Thanks Eitan, the bug has been resolved.

nacho

nacho de Quilmes

unread,
Aug 27, 2008, 5:26:57 PM8/27/08
to jma...@googlegroups.com
 I mean solved

nacho de Quilmes

unread,
Aug 27, 2008, 7:15:16 PM8/27/08
to jma...@googlegroups.com
Hi Eitan:

I have bad news, I have the same error when I assigned restrictions to an object on the interface. I was assigning restrictions for a time, and then the system thrwon next exceptions:
org.hibernate.HibernateException: instance not of expected entity type: com.u2d.element.TypeCommand is not a: com.u2d.element.Command


Then if I tried to assigned more restrictions to another object, the system thrown next exception: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.u2d.element.EOCommand#162]
    at org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:590)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:284)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:223)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:89)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
    at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
    at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
    at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:218)
    at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
    at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
    at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
    at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
    at org.hibernate.event.def.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:431)
    at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:265)
    at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
    at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
    at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
    at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
    at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535)
    at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
    at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519)
    at com.u2d.app.TypeRestrictionMgr$2.invoke(TypeRestrictionMgr.java:84)
    at com.u2d.persist.HibernatePersistor$1.invoke(HibernatePersistor.java:121)
    at com.u2d.persist.HibernatePersistor.transactionReturn(HibernatePersistor.java:101)
    at com.u2d.persist.HibernatePersistor.transaction(HibernatePersistor.java:117)
    at com.u2d.app.TypeRestrictionMgr.ApplyChanges(TypeRestrictionMgr.java:73)
    at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.u2d.element.EOCommand.execute(EOCommand.java:110)
    at com.u2d.element.EOCommand.execute(EOCommand.java:95)
    at com.u2d.view.swing.CommandAdapter$2.offEDT(CommandAdapter.java:118)
    at com.u2d.view.swing.SwingViewMechanism$16.run(SwingViewMechanism.java:1035)
    at java.lang.Thread.run(Thread.java:619)


I hope you will be able to fix the problem

nacho

nacho de Quilmes

unread,
Aug 27, 2008, 7:23:53 PM8/27/08
to jma...@googlegroups.com
This is the first exception that my system thrown:


org.hibernate.HibernateException: instance not of expected entity type: com.u2d.element.TypeCommand is not a: com.u2d.element.Command
    at org.hibernate.persister.entity.AbstractEntityPersister.getSubclassEntityPersister(AbstractEntityPersister.java:3640)
    at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1347)
    at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180)
    at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:512)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:80)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.u2d.element.EOCommand.execute(EOCommand.java:110)
    at com.u2d.element.EOCommand.execute(EOCommand.java:95)
    at com.u2d.view.swing.CommandAdapter$2.offEDT(CommandAdapter.java:118)
    at com.u2d.view.swing.SwingViewMechanism$16.run(SwingViewMechanism.java:1035)
    at java.lang.Thread.run(Thread.java:619)


nacho de Quilmes

unread,
Aug 27, 2008, 7:43:16 PM8/27/08
to jma...@googlegroups.com
I found that the system thrown the exception when I assigned restrictions to this action:

 @Cmd
    public static Reportable reporteRequerimientos(CommandInfo cmdInfo) {
        return new Reportable() {
            public String reportName() {
                return RutaXmlReportes.REPORTE1;
            }

            public Properties properties() {
                return new Properties();
            }

            public TableModel tableModel() {
                return ConsultasPredefinidas.requerimientos().tableModel();
            }

            public ReportFormat reportFormat() {
                return ReportFormat.PDF;
            }
        };
    }


Thanks for your help

nacho

Eitan Suez

unread,
Aug 27, 2008, 11:04:02 PM8/27/08
to jma...@googlegroups.com
hi nacho,
  i forgot to tell you that the fix needs to be made to your application (sorry).
  that is, you need to revise your copy of src/persistClasses.st to match
  that of, for example, Sympster.  then it will work.  sorry about this oversight.
/ eitan

nacho de Quilmes

unread,
Aug 28, 2008, 3:21:49 PM8/28/08
to jma...@googlegroups.com
hi eitan:
I'm still experiencing a lot troubles with this. When I build a jws dist and run it, the system throws the following exception when I add a new restriction:

org.hibernate.exception.ConstraintViolationException: could not insert: [com.u2d.element.EOCommand]
    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2272)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2665)
    at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:60)
    at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
    at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
    at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
    at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
    at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
    at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
    at com.u2d.persist.HibernatePersistor.transactionReturn(HibernatePersistor.java:103)

    at com.u2d.persist.HibernatePersistor.transaction(HibernatePersistor.java:117)
    at com.u2d.app.TypeRestrictionMgr.ApplyChanges(TypeRestrictionMgr.java:73)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)

    at com.u2d.element.EOCommand.execute(EOCommand.java:110)
    at com.u2d.element.EOCommand.execute(EOCommand.java:95)
    at com.u2d.view.swing.CommandAdapter$2.offEDT(CommandAdapter.java:118)
    at com.u2d.view.swing.SwingViewMechanism$16.run(SwingViewMechanism.java:1035)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "command_fullpath_key"
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1592)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:350)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:304)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2255)
    ... 22 more

Once this exception is thrown, I can't add another restriction. If I execute the program again, (through ws or the IDE), the problem persist.

Thanks for your time.

Eitan Suez

unread,
Aug 28, 2008, 5:23:54 PM8/28/08
to jma...@googlegroups.com
ok, i'll take another look and try to reproduce.  perhaps tomorrow.
/ eitan

nacho de Quilmes

unread,
Sep 2, 2008, 2:35:42 PM9/2/08
to jma...@googlegroups.com
Hi Eitan!

Could you reproduce the bug with restrictions and jws?

nacho

Eitan Suez

unread,
Sep 2, 2008, 2:40:25 PM9/2/08
to jma...@googlegroups.com
sorry, not yet.
/ eitan
Reply all
Reply to author
Forward
0 new messages