-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Load new annotated entity at runtime
PostPosted: Sun Dec 09, 2007 5:27 pm 
Newbie

Joined: Sun Mar 18, 2007 9:14 am
Posts: 4
Hello,

Can anyone tell me if it is possible to load a new annotated entity at runtime without restarting of the application?

Eg: I have an annotated class in the core application.

@Entity
class CustomerVersion1
@Id
private Long id;
private String name;
...

The application has started and it is running. In runtime the user has decided to add a new field into the customer entity eg:age

The program generates a new entity(which extends the previous version) CustomerVersion2 and compiles it into class. Then I would like to load this new entity into the system without restart the server.

@Entity
CustomerVersion2 extends CustomerVersion1
private Long age;
...

Is it possible to do it?


Can you offer an annotation based solution where customer can define new fields at runtime into the entity? I would not like to use a new entity which keeps the user defined fields in a key value structure.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 19, 2008 4:05 am 
Beginner
Beginner

Joined: Mon Oct 01, 2007 8:21 am
Posts: 40
Hi,

Im doing with the Hibernate search not able to index properly, i don no wht could b the porblem, pls any body could go through it and tell me what could b the prob.


@Entity
@Indexed
class EventDb{
@IndexedEmbedded(prefix="EvtSessionInfo_", depth=2)
private List<EvtSessionInfo> evtSessionInfos = new ArrayList<EvtSessionInfo>(0);
}

@Entity
@Indexed
class EvtSessionInfo{
@IndexedEmbedded(prefix="hallMeetingRoom_", depth =1)
private HallMeetingRoom hallMeetingRoom;

@NaturalId
@ContainedIn
private EventDb eventDb;

}

@Entity
@Indexed
class HallMeetingRoom{
@Field(index=Index.TOKENIZED, store=Store.NO)
private String hallMeetingRoomName;
}

Im making the index of EventDb like this
Code:
try {
   Session session = null;
     SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
     session =sessionFactory.openSession();
   FullTextSession fullTextSession = Search.createFullTextSession(session);
   

   List<EventDb> eventDbTx = session.createQuery("from EventDb").list();
   for(EventDb eventDbTx1 : eventDbTx){
      System.out.println("Inside Creating Index........");
      fullTextSession.index(eventDbTx1);
   }
   
   session.close();
   } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
   }


In the above index EventSessionInfo has the bidirectional approach to EventDb and HallMeetingRoom doesn't have a bidirectional approach to EventSessionInfo. I don no whether this is making any problem or depth is making prob, i feel depth is proper.

When i open the EventDb index im able to eventSessionInfo and not the HallMeetingRoom info.

Any other proper way to handle this.

Could anyone come up on this, to solve my issue.

Thanks,
Ambika☺


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.