Page 3 of 3 FirstFirst 123
Results 21 to 25 of 25

Thread: Spring + hibernate

  1. #21
    Join Date
    Aug 2011
    Posts
    20

    Arrow

    Quote Originally Posted by amiladomingo View Post
    I used AnnotationSessionFactoryBean and it works.



    Above exception comes because of invalid casting.

    What is the reason you want to get AnnotationSessionFactoryBean from context?
    can you post the project that you realize with all the jars that you use

    i haven't a very important reason, but i want that because i have encountred this exception and i saw many examples which the author use the AnnotationSessionFactoryBean.

    thank you for the reply

    ---------------
    Blacky

  2. #22
    Join Date
    Dec 2010
    Location
    Singapore
    Posts
    284

    Default

    Ahh you want to retrieve the FactoryBean and not the object. Then you need to prefix the name with &. (i.e. '&sessionFactory')
    Amila Domingo

  3. #23
    Join Date
    Aug 2011
    Posts
    20

    Thumbs up

    Quote Originally Posted by amiladomingo View Post
    Ahh you want to retrieve the FactoryBean and not the object. Then you need to prefix the name with &. (i.e. '&sessionFactory')
    Hello thank you very very very and 1000000000000000000000000000000000000^999999999999 999999999999999999999 very much
    it worked very well
    this tric, its a magic, can you tell me why, i would to know why we must add this littale prefix ?

    can you give me the final help

    ------------------
    Blacky

  4. #24
    Join Date
    Dec 2010
    Location
    Singapore
    Posts
    284

    Default

    From spring reference,

    When you need to ask a container for an actual FactoryBean instance itself, not the bean it produces, you preface the bean id with the ampersand symbol & (without quotes) when calling the getBean() method of the ApplicationContext. So for a given FactoryBean with an id of myBean, invoking getBean("myBean") on the container returns the product of the FactoryBean, and invoking getBean("&myBean") returns the FactoryBean instance itself.
    Note that, AnnotationSessionFactoryBean class implements the spring FactoryBean interface.
    Amila Domingo

  5. #25
    Join Date
    Aug 2011
    Posts
    20

    Thumbs up

    Thank you very much

    ------------
    Blacky

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •