Re: [T5]: Hibernate question - session is null

2008-07-26 Thread Mark Weissenberg
Hi,

I also had some trouble configuring hibernate, my session was also null.

After searching for a while I found this tutorial:
http://linuxboy.javaeye.com/blog/68311


Since I dont use a DAO, my code looks something like the following.


my db entity:
...

import org.hibernate.Session;

@Entity
@Table(name = EVENT)
public class EventDBEntity {
public EventDBEntity() {}
public EventDBEntity(Session session) {_session = session;}
@Transient
private Session _session;
// more stuff here.. methods to access the db
...


in my appmodule.java:

...

public static void bind(ServiceBinder binder)
{
binder.bind(TourDBEntity.class);
}
...


then I call an @Inject on the db-entity:
...
// db entity object
@Inject
private EventDBEntity _dbEntity;

// now tapestry injects the hibernate session in my _dbEntity
...

Hope this helps!

Greetings, Mark

--
Mark Weißenberg
Tel. +49 228 9599630
startext Unternehmensberatung GmbH
Kennedyallee 2, D-53175 Bonn
Geschäftsführer Paul Bantzer, HRB Bonn 2741
Sitz der Gesellschaft: Bonn

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Error Adding New Property Editors

2008-07-22 Thread Mark Weissenberg
Hi,

I want to add a new property editor to show a dropdown-select from a Java List
of Strings.

I dont know where to put my AppPropertyEditBlocks.java and
AppPropertyEditBlocks.tml files.

If I put them under my services, I get the error:

org.apache.tapestry5.internal.services.RenderQueueException
Render queue error in
BeginRender[tour/Request:beaneditform.editor.propertyeditor]: Unable to locate
a block to edit property 'guideList' (with data type 'dropdown') of object
[EMAIL PROTECTED]: Unable to resolve
'AppPropertyEditBlocks' to a known page name. Available page names: (blank),
Appointm.

If I put them under my pages, I get the error:

org.apache.tapestry5.internal.services.RenderQueueException
Render queue error in
BeginRender[tour/Request:beaneditform.editor.propertyeditor]: Unable to locate
a block to edit property 'guideList' (with data type 'dropdown') of object
[EMAIL PROTECTED]: Embedded component
'select' has no type. You should specify a type in the component template, or
define the component inside class
de.startext.tapestry.hida.pages.AppPropertyEditBlocks using the @Component
annotation on a private instance variable.

I added the following lines to my AppModule class:

@SuppressWarnings(unchecked)
public static void
contributeDefaultDataTypeAnalyzer(MappedConfigurationClass, String
configuration)
{
  configuration.add(DropDownList.class, dropdown);
}

public void contributeBeanBlockSource(ConfigurationBeanBlockContribution
configuration)
{
configuration.add(new BeanBlockContribution(dropdown,
AppPropertyEditBlocks, dropdown, true));
}

I followed these instructions:

http://tapestry.apache.org/tapestry5/tapestry-core/guide/beaneditform.html
http://wiki.apache.org/tapestry/Tapestry5HowToCreateAPropertyEditBlock

my AppPropertyEditBlocks.java:
public class AppPropertyEditBlocks
{
@Environmental
private PropertyEditContext context;
@SuppressWarnings(unused)
@Component(parameters =
{value=selected,
label=prop:context.label,
encoder=valueEncoderForSelected,
model=selectModelForDropDownList,
validate=prop:context.validator,
clientId=prop:context.propertyId})
private Select selectList;

public PropertyEditContext getContext() { return context; }
public int getSelected() {
return ((DropDownList)this.context.getPropertyValue()).getSelected();
}
public void setSelected(int value) {
((DropDownList)this.context.getPropertyValue()).setSelected(value);
}
@SuppressWarnings(unchecked)
public ValueEncoder getValueEncoderForSelected() {
return new ValueEncoder() {
public String toClient(Object value) { return
((Integer)value).toString();}
public Object toValue(String clientValue) { return new
Integer(clientValue);}
};
}
}

my AppPropertyEditBlocks.tml-file:
div xml:space=default
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
t:block t:id=dropdown
t:label for=select/
input t:id=select/
/t:block
/div

Any help would be great!

Thanks, Mark

--
Mark Weißenberg
Tel. +49 228 9599630
startext Unternehmensberatung GmbH
Kennedyallee 2, D-53175 Bonn
Geschäftsführer Paul Bantzer, HRB Bonn 2741
Sitz der Gesellschaft: Bonn

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Error Adding New Property Editors

2008-07-22 Thread Mark Weissenberg
Hi, fixed my problem:

div xml:space=default
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
 t:block id=dropdown
  t:label for=selectList/
  t:select t:id=selectList model=selected/
 /t:block
/div

and the files are under my pages directory.

Thanks and bye,
Mark

 Hi,

 I want to add a new property editor to show a dropdown-select from a Java
List
 of Strings.

 I dont know where to put my AppPropertyEditBlocks.java and
 AppPropertyEditBlocks.tml files.

 If I put them under my services, I get the error:

 org.apache.tapestry5.internal.services.RenderQueueException
 Render queue error in
 BeginRender[tour/Request:beaneditform.editor.propertyeditor]: Unable to
locate
 a block to edit property 'guideList' (with data type 'dropdown') of object
 [EMAIL PROTECTED]: Unable to resolve
 'AppPropertyEditBlocks' to a known page name. Available page names: (blank),
 Appointm.

 If I put them under my pages, I get the error:

 org.apache.tapestry5.internal.services.RenderQueueException
 Render queue error in
 BeginRender[tour/Request:beaneditform.editor.propertyeditor]: Unable to
locate
 a block to edit property 'guideList' (with data type 'dropdown') of object
 [EMAIL PROTECTED]: Embedded component
 'select' has no type. You should specify a type in the component template, or
 define the component inside class
 de.startext.tapestry.hida.pages.AppPropertyEditBlocks using the @Component
 annotation on a private instance variable.

 I added the following lines to my AppModule class:

 @SuppressWarnings(unchecked)
 public static void
 contributeDefaultDataTypeAnalyzer(MappedConfigurationClass, String
 configuration)
 {
   configuration.add(DropDownList.class, dropdown);
 }

 public void
contributeBeanBlockSource(ConfigurationBeanBlockContribution
 configuration)
 {
 configuration.add(new BeanBlockContribution(dropdown,
 AppPropertyEditBlocks, dropdown, true));
 }

 I followed these instructions:

 http://tapestry.apache.org/tapestry5/tapestry-core/guide/beaneditform.html
 http://wiki.apache.org/tapestry/Tapestry5HowToCreateAPropertyEditBlock

 my AppPropertyEditBlocks.java:
 public class AppPropertyEditBlocks
 {
 @Environmental
 private PropertyEditContext context;
 @SuppressWarnings(unused)
 @Component(parameters =
 {value=selected,
 label=prop:context.label,
 encoder=valueEncoderForSelected,
 model=selectModelForDropDownList,
 validate=prop:context.validator,
 clientId=prop:context.propertyId})
 private Select selectList;

 public PropertyEditContext getContext() { return context; }
 public int getSelected() {
 return ((DropDownList)this.context.getPropertyValue()).getSelected();
 }
 public void setSelected(int value) {
 ((DropDownList)this.context.getPropertyValue()).setSelected(value);
 }
 @SuppressWarnings(unchecked)
 public ValueEncoder getValueEncoderForSelected() {
 return new ValueEncoder() {
 public String toClient(Object value) { return
 ((Integer)value).toString();}
 public Object toValue(String clientValue) { return new
 Integer(clientValue);}
 };
 }
 }

 my AppPropertyEditBlocks.tml-file:
 div xml:space=default
 xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
 t:block t:id=dropdown
 t:label for=select/
 input t:id=select/
 /t:block
 /div

 Any help would be great!

 Thanks, Mark

 --
 Mark Weißenberg
 Tel. +49 228 9599630
 startext Unternehmensberatung GmbH
 Kennedyallee 2, D-53175 Bonn
 Geschäftsführer Paul Bantzer, HRB Bonn 2741
 Sitz der Gesellschaft: Bonn

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



--
Mark Weißenberg
Tel. +49 228 9599630
startext Unternehmensberatung GmbH
Kennedyallee 2, D-53175 Bonn
Geschäftsführer Paul Bantzer, HRB Bonn 2741
Sitz der Gesellschaft: Bonn
-d

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]