Ext


Go Back   Ext JS Forums > Ext General Forums > Gxt: Open Discussion

Reply
 
Thread Tools
  #1  
Old 12-05-2008, 06:02 AM
sdc sdc is offline
Ext User
 
Join Date: Jun 2008
Posts: 365
sdc is on a distinguished road
Default Java Bean support and @BEAN

I really love Java Bean support, especially the solution with the @BEAN annotation. It is awesome that you can use a POJO which doesn't implement ModelData or anything else from GXT and that you don't have to manage with the get/set properties stuff. You can find some information here : http://extjs.com/blog/2008/07/14/preview-java-bean-support-with-ext-gwt/

However, we still have to create an interface extending BeanModelMarker and then annotating it with our bean class (e.g. @BEAN(Customer.class) public interface CustomerBeanModel...). This way we don't have to modify our bean class but I'm not sure we can really be happy with creating an interface for each POJO class. Ok, you can tell me "you can make your bean implementing BeanModelTag instead of creating a new interface", but if I have to introduce a GXT dependency in my POJO class, I would definitely rather use an annotation than an interface.

I'd like to know what do you think about it ? Do you like creating an interface so that you don't have to modify your POJO class (you don't want to introduce any GXT dependency in your POJOs, even an annotation) or would you rather put the annotation directly in your POJO class (because it is quicker and because an annotation is a weak dependency) ? Or maybe you don't care about implementing BeanModelTag ?

By the way, in the blog post, I read
Quote:
by using a marker interface, other configuration information can be specified by annotations.
Which other configuration information than @BEAN can we specify ?
Reply With Quote
  #2  
Old 01-16-2009, 09:15 AM
zaccret zaccret is offline
Ext User
 
Join Date: Apr 2008
Posts: 375
zaccret is on a distinguished road
Default

Hi,

+1. It wouldn't be possible to just add the annotation on the POJO classes instead of creating interfaces ???
Reply With Quote
  #3  
Old 01-17-2009, 06:30 AM
EagleEye666666 EagleEye666666 is offline
Ext User
 
Join Date: Oct 2008
Location: Warsaw(PL)/Cottbus(GER)
Posts: 215
EagleEye666666 is on a distinguished road
Send a message via ICQ to EagleEye666666
Default

For my part i can live with implementing the BeanModelTag. It works very fine for me and doesn't harm at all.

@Entity
@Table(name = "USER")
public class User extends LightEntity implements BeanModelTag, Serializable {

	private static final long serialVersionUID = 2776494633319384131L;

	@Id
	@GeneratedValue
	@Column(name = "ID", unique = true, nullable = false)
	private Integer id;

	@Column(name = "LOGIN", unique = true, nullable = false, length = 20)
	private String login;
....
..
.
Just creating all the time some BeanModel (from the Factory) of the object is quite annoying, this will be solved by that Annotation as well?

regards
Reply With Quote
  #4  
Old 01-19-2009, 05:10 AM
sdc sdc is offline
Ext User
 
Join Date: Jun 2008
Posts: 365
sdc is on a distinguished road
Default

What I don't like with the BeanModelTag solution is that you introduce a GXT dependency in your POJOs. Then you can't just reuse these classes in a similar project which doesn't use GXT. In my case, I have a "core" project/module which has the business entities (aka domain objects, POJOs) and the business services, so no GXT dependency in this project. Then I have the web module which depends on the core module and on GXT.
Reply With Quote
  #5  
Old 01-19-2009, 06:21 AM
EagleEye666666 EagleEye666666 is offline
Ext User
 
Join Date: Oct 2008
Location: Warsaw(PL)/Cottbus(GER)
Posts: 215
EagleEye666666 is on a distinguished road
Send a message via ICQ to EagleEye666666
Default

Quote:
Originally Posted by sdc View Post
What I don't like with the BeanModelTag solution is that you introduce a GXT dependency in your POJOs. Then you can't just reuse these classes in a similar project which doesn't use GXT. In my case, I have a "core" project/module which has the business entities (aka domain objects, POJOs) and the business services, so GXT dependency in this project. Then I have the web module which depends on the core module and on GXT.
Well okay i havent thought about this, i agree than this dependency isnt very well. So it would be a nice idea to implement it as you mentioned.

agree
Reply With Quote
  #6  
Old 11-03-2009, 12:41 PM
iaio81 iaio81 is offline
Ext User
 
Join Date: Nov 2009
Posts: 8
iaio81 is on a distinguished road
Default

I've a similar problem. I have entities grouped in a jar and return them from EJB methods. Deploy of entities jar on JBOSS is OK. The problem is that if I try use both methods (@BEAN or implements BeanModelTag) GWT give a NoClassDefFound Error, who can help me?
Reply With Quote
Reply

Thread Tools

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 10:06 AM.

© 2006-2009 Ext, LLC
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.