The IHibernateProxy is specific to the approach taken by the  
dpHibernate people. The way that Flex handles object remoting is by  
serializing and deserializing java objects to the client. Normally  
these are just POJOs - but the approach the dphibernate project takes  
is to send down hibernate proxies - and then on the client side when a  
property is requested that is not yet loaded - a message is sent to  
the server to retrieve that property, and it is sent back down  
transparently to the client of the object.

The IHibernateProxy interface just tracks enough information to be  
able to facilitate the process. It's not an official hibernate class  
or anything. The client doesn't really know it's accessing the db (and  
in some cases, it might technically not be - if the stuff is in  
hibernates cache) - it just knows that it's loading a property that  
hasn't been loaded yet because something is trying to access it. (at  
least that's what my understanding is of their process - when I work  
with it in more depth I'll have a better idea)

Yes, I know I should start dealing with the templates directly :) The  
server side of it wont need to be changed too drastically - it's the  
client side that will generate actionscript code that will be most  
definitely be different. I will probably have to start a new generator  
module (cartridge?) for that - and I'm still poking around the  
existing pieces to figure out what is involved in that process.

Ryan

On Aug 8, 2008, at 12:13 AM, Patrik Nordwall wrote:

>
> I think you should start implementing in the templates instead of  
> using
> SpecialCases. This flex support is such an big addition that it will  
> soon
> become impossible to add everything using oAW AOP.
>
> I think your specific question is easiest solved by replacing
> AbstractDomainObject.
>
> In your sculptor-generator.properties you can define the class name
> framework 
> .abstractDomainObjectClass 
> =org.fornax.cartridges.sculptor.framework.domain.AbstractDomainObject2
>
> Add the interface to AbstractDomainObject2, which can extend
> AbstractDomainObject.
>
> IHibernateProxy is new to me. I will read up on it. When lazy  
> loading, will
> it populate the associations using database access from the tier  
> where it is
> invoked, i.e. in the flex tier?
> I'm working with the Rich Client Support, using Eclipse RCP, and in my
> current solution I have solved this in a different way. I can't  
> access db
> from client.
>
> /Patrik
>
>
> Ryan Gardner wrote:
>>
>> I've got a few thoughts on how to get the flex pieces to generate  
>> from
>> the sculptor. I'm still focusing on the java / server side of things
>> for now - the flex pieces will come later.
>>
>> The most challenging thing that I'm facing is that to properly use
>> lazy loading across the channel to the flex side, I need to have the
>> objects that I'm working with all implement a certain interface - one
>> provided by another project called dpHibernate.
>>
>> The interface is simple:
>>
>> public interface IHibernateProxy
>> {
>>      Object getProxyKey();
>>      void setProxyKey(Object obj);
>>      
>>      Boolean getProxyInitialized();
>>      void setProxyInitialized(Boolean b);    
>> }
>>
>>
>> and the implementation is actually the same for all of the objects...
>> They provide an abstract class that you can have everything inherit
>> from - but since we're generating the code anyway there is no reason
>> to not just make them implement the interface and avoid the issue of
>> inheritance.
>>
>> In my initial stages, I've been working with SpecialCases.xpt to make
>> the server side code modified to the point where it will do what I
>> want before I start to think about how to get it to generate it in  
>> the
>> templates... etc. - but I can't seem to get the domain object to take
>> on any interfaces because I don't see how to advice the
>> getExtendsAndImplementsLitteral() method that's in the helper.ext -
>>
>>
>> «AROUND *::domainObjectBase FOR DomainObject»
>>      «LET attributes.exists(a | a.name == "uuid")  AS hasUuidAttribute  
>> -»
>>     «FILE javaFileName(getDomainPackage() + "." + name + "Base")»
>> package «getDomainPackage()»;
>>
>>
>> /**
>>  * Generated base class, which implements properties and
>>  * associations for the domain object.
>>  */
>> public abstract class «name»Base  
>> «getExtendsAndImplementsLitteral()»  {
>>
>>     «EXPAND DomainObject::attribute FOREACH attributes»
>>
>>     «EXPAND DomainObject::oneReferenceAttribute FOREACH
>> references.select(r | !r.many)»
>>     «EXPAND DomainObject::manyReferenceAttribute FOREACH
>> references.select(r | r.many)»
>>
>>     «IF
>> getConstructorParameters().isEmpty»public«ELSE»protected«ENDIF»
>> «name»Base() {
>>     }
>>
>>     «EXPAND DomainObject::propertyConstructorBase-»
>>
>>     «EXPAND DomainObject::propertyAccessors FOREACH
>> attributes.select(a | a.name != "uuid") »
>>     «IF hasUuidAttribute -»
>>          «EXPAND DomainObject::uuidAccessor»
>>     «ENDIF-»
>>
>>
>>     «EXPAND DomainObject::oneReferenceAccessors FOREACH
>> references.select(r | !r.many)»
>>     «EXPAND DomainObject::manyReferenceAccessors FOREACH
>> references.select(r | r.many)»
>>
>>     «EXPAND DomainObject::acceptToString»
>>     «IF !abstract -»
>>         «EXPAND DomainObject::keyGetter»
>>     «ENDIF-»
>>      /* code goes here */
>> }
>>     «ENDFILE»
>>     «ENDLET»
>> «ENDAROUND»
>>
>> If I hard code in anything after the
>> «getExtendsAndImplementsLitteral()» such as "implements
>> net.digitalprimates.persistence.hibernate.proxy.IHibernateProxy" the
>> java beautifier throws exceptions when I try to run the generation.
>>
>> Any thoughts on how to get the DomainBase objects to all implement a
>> specific interface? The implementation of the interface will always
>> look like this:
>>      ----
>>      public Object proxyKey;
>>      public Boolean proxyInitialized = true;
>>
>>      
>>      public Object getProxyKey()
>>      {
>>              return proxyKey;
>>      }
>>
>>      
>>      public void setProxyKey(Object proxyKey)
>>      {
>>              this.proxyKey = proxyKey;
>>      }
>>
>>      
>>      public Boolean getProxyInitialized()
>>      {
>>              return proxyInitialized;
>>      }
>>
>>      
>>      public void setProxyInitialized(Boolean proxyInitialized)
>>      {
>>              this.proxyInitialized = proxyInitialized;
>>      }
>>      ----
>> I suppose I could do some after-the-fact rigging using AOP and create
>> an introduction that would cause all of the domain objects to
>> implement this interface without changing their base code, but I  
>> think
>> it would be a lot cleaner if I could just figure out how to get oAW
>> and Sculptor to do it for me.
>>
>> Any thoughts?
>>
>> Ryan
>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win  
>> great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Fornax-developer mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/fornax-developer
>>
>>
>
> -- 
> View this message in context: 
> http://www.nabble.com/Getting-the-DomainBase-objects-to-implement-an-interface-in-Sculptor...--tp18879832s17564p18886161.html
> Sent from the Fornax-Platform mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's  
> challenge
> Build the coolest Linux based applications with Moblin SDK & win  
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in  
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Fornax-developer mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/fornax-developer


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Fornax-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Reply via email to