facebook

Problem with hibernate and log4j

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #247986 Reply

    Hello,
    first things first. I just installed a fresh eclipse 3.1.2 and myeclipse 4.1.1 release today. There are no other third party plugins.

    My problem is this…when I run my application with log4j rootLogger=info there is no problem. When I run the same code changing only the rootLogger=debug hibernate is no longer able to insert data into the database. This is very weird and I have been stuck trying to figure out how to resolve this issue. Any help would be greatly appreciated. Also, please let me know if I have missed any information.

    Thanks,
    Doug

    #248000 Reply

    Haris Peco
    Member

    Doug,

    Please send ud Error log (Windows-show View-Other-PDE runtime-Error log View).I will try your case

    Best

    #248002 Reply

    Haris Peco
    Member

    Doug,

    I have tried your case (log4j.logger.org.hibernate=debug) and it work for me, but I haven’t all details
    Please, send your database and version and mappings and log4j details

    Thanks

    #248007 Reply

    Hello and thanks for the quick response.

    Here is the error that i am getting. ### There was a problem with creating the rule! com.med.aae.domain.RuleAttributeJoin Problem was: null
    java.lang.ClassCastException: com.med.aae.domain.RuleAttributeJoin
    at org.hibernate.type.EntityType.toLoggableString(EntityType.java:154)
    at org.hibernate.pretty.Printer.toString(Printer.java:53)
    at org.hibernate.pretty.Printer.toString(Printer.java:90)
    at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:97)
    at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
    at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:980)
    at com.med.aae.dao.RuleDAO.saveRuleAttributeValue(RuleDAO.java:203)
    at com.med.aae.dao.RuleDAO.saveAttributeMetaData(RuleDAO.java:299)
    at com.med.aae.dao.RuleDAO.createRuleDefinition(RuleDAO.java:339)
    at com.med.aae.bo.RuleDefinition.createRule(RuleDefinition.java:81)
    at com.med.aae.bo.RuleDefinition.main(RuleDefinition.java:379)

    This class is mapped to a bridge table which is a parent of 1 and a child of 2.

    It is just weird that this issue only pops up when the logging is set to debug. FYI…I am not using the MyEclipse library’s for hibernate and instead I am copy all the necessary folders to the lib directory of my feature and then placing them in the classpath. It works fine when logging is set to info but as soon as I run it with debug it has a problem. Also, I am not able to run this in the app server at all. I get the same error regardless of what the value is set to. FYI again, I am running jboss4.0.3 and it’s a clean install.

    Any further help wold be greatly appreciated.

    Thanks,
    Doug

    #248011 Reply

    Haris Peco
    Member

    Doug,

    What is your database and version, hibernate version (your libraries) ? Can you send us problematic database schema script, mapping files, POJO and application code ?

    Best

    #248015 Reply

    I am running mysql 5.0 and hibernate 3.1. I would rather not send my business code but I would be happy to send my mappings so you could create a database. How do you want me to handle that?

    #248020 Reply

    Haris Peco
    Member

    Doug,

    I will try simple mapping and insert with MySQL 5.0 (5.0.15) and you send mappings – it is ok

    Best

    #248032 Reply

    Haris Peco
    Member

    Doug,

    I have tried with MySQL 5.0.15 : make MyEclipse mappings, make test for update and delete (2 tables with FK) and it work

    I saw your log and this is your class ‘java.lang.ClassCastException: com.med.aae.domain.RuleAttributeJoin’
    If you have logging in your class then you have problem with mixed log libraries (2 kind log libraries) in projects
    I suppose that you have own libraries (incompatible with hibernate) and in some moment you get ClassCastException.
    I’don’t sure and it is very hard find bug without more details – however , select/update/insert/delete with mySQL 5.0 and MyEclipse generating work – I will try help more if you send more details (what you can, of course)

    Best

    #248272 Reply

    I am actually investigating wether this is a Hibernate bug. The exception gets thrown when the logging is in debug mode because Hibernate’s EntityType.toLoggableString(EntityType.java:154) can’t determine what type of object this is. Thanks for your help and I’ll try post my findings.

    #249296 Reply

    NorthVan
    Member

    I had a similar problem, though I wasn’t using My eclipse.

    I had an

     ClassCastException
    at org.hibernate.type.EntityType.toLoggableString(EntityType.java:154)
    

    I found the the problem was something to do with hibernate debugging.

    To fix, try making sure that you have log4j set up properly: copy the log4j.properties file from hibenate-3.1/etc to the root of the classpath.

    This fixed things for me.

    (I believe the bug is something to do with descendent classes not begin able to be cast to ancestors because of cglib)

    #249298 Reply

    Haris Peco
    Member

    There is bug with type conversion in some version hibernate 3.1.x
    Try use latest 3.1.3, but MyEclipse support 3.0.5 and it is better that you use version 3.0.5

    Best

Viewing 11 posts - 1 through 11 (of 11 total)
Reply To: Problem with hibernate and log4j

You must be logged in to post in the forum log in