Re: Res: Res: session.persist saves object with id 0

2010-06-09 Thread Genís Pujol

Hello list,

Thanks for all the replies :)

I've actually created the entities and the xml + annotations mappings 
using the eclipse hibernate plugin, I've just added the tapestry 
annotations.


For example for the user entity:

http://dpaste.com/205037/

Hibernate xml mapping file:

http://dpaste.com/205038/

CRUD code:
@Inject
Session session

@Component
private Usuario _user;

@CommitAfter
Object onSuccess()
{
try {
   session.persist(_user);
}
catch (RuntimeException e) {
throw e;
}
return this;
}

thank you people!

greetings,

Genis


Al 08/06/2010 14:35, En/na Everton Agner ha escrit:

And I forgot to mention it...

Yes, the @CommitAfter annotation tells Tapestry to wrap that method in 
a Transaction when it will call it... So, is enough to just .persist() 
it. ;)



*De:* Everton Agner everton_ag...@yahoo.com.br
*Para:* Tapestry users users@tapestry.apache.org; gpu...@ngeografics.com
*Enviadas:* Terça-feira, 8 de Junho de 2010 9:32:36
*Assunto:* Res: session.persist saves object with id 0

Could you show us how you mapped your Entity?** And regardless if it 
was by XML or Annotations, show your Entity class code too.*



De:* Peter Stavrinides p.stavrini...@albourne.com
*Para:* Tapestry users users@tapestry.apache.org; gpu...@ngeografics.com
*Enviadas:* Terça-feira, 8 de Junho de 2010 5:39:14
*Assunto:* Re: session.persist saves object with id 0

Perhaps the type is a primitive, so instead of null a default value 
will be 0? just a guess.


Peter


- Original Message -
From: Genís Pujol gpu...@ngeografics.com 
mailto:gpu...@ngeografics.com
To: Tapestry users users@tapestry.apache.org 
mailto:users@tapestry.apache.org
Sent: Tuesday, 25 May, 2010 18:30:10 GMT +02:00 Athens, Beirut, 
Bucharest, Istanbul

Subject: session.persist saves object with id 0

Hello,

After checking the tutorial I was trying to do a basic crud app, but
somehow after submiting the form (beaneditform) the new object is saved
into the database with id 0.

I'm also new to hibernate so I don't know why in the tapestry tutorial
is enough with session.persist(object), what happened to the factory,
session.commit, session.close and the Transaction object? is that all
included with the @CommitAfter annotation?


Any idea why a new object would be saved with id 0?

regards,

Genis

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org 
mailto:users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org 
mailto:users-h...@tapestry.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org 
mailto:users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org 
mailto:users-h...@tapestry.apache.org








Re: Res: Res: Res: session.persist saves object with id 0

2010-06-09 Thread Genís Pujol

Al 09/06/2010 14:27, En/na Thiago H. de Paula Figueiredo ha escrit:
On Wed, 09 Jun 2010 09:16:55 -0300, Everton Agner 
everton_ag...@yahoo.com.br wrote:


I'm not a Hibernate advanced user, but you're using a XML and Entity 
class annotations to configure your Entity?


I haven't noticed that. Ewerton is right: no need to use XML mappings 
when you use annotations.


Anyways... If you want your app to automatically increment your ID 
before saving it, you shouldn't use the:


In this case, it isn't the app the increments the ID, the database does.


generator class=assigned /


Or @GeneratedValue.



thanks for the replies :)

I generate the classes using eclipse hibernate plugin, which creates the 
xml and the classes with the annotations (redundant I know, but doesn't 
matter atm).


The database (Oracle 10g) has an index so it knows which Id to assign 
next to the new record, but instead of this the new object gets Id = 0 
(the next one Id=1 and so forth).
It should be the db who assigns the right Id to the new record, but I 
don't know why this isn't happening...


I've tried with

@GeneratedValue(strategy = GenerationType.IDENTITY)

and

@GeneratedValue(strategy = GenerationType.AUTO)

with the same result (id=0)



hm...

Genis


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Res: Res: Res: session.persist saves object with id 0

2010-06-09 Thread Genís Pujol

Al 09/06/2010 16:24, En/na Thiago H. de Paula Figueiredo ha escrit:
On Wed, 09 Jun 2010 11:18:16 -0300, Genís Pujol 
gpu...@ngeografics.com wrote:


The database (Oracle 10g) has an index so it knows which Id to assign 
next to the new record, but instead of this the new object gets Id = 
0 (the next one Id=1 and so forth).
It should be the db who assigns the right Id to the new record, but I 
don't know why this isn't happening...


I've tried with

@GeneratedValue(strategy = GenerationType.IDENTITY)

and

@GeneratedValue(strategy = GenerationType.AUTO)

with the same result (id=0)


Again, use Long instead of long for the id. Have you looked at the 
table to see what's the id of the created line?


By the way, what you're having has nothing to do with Tapestry or 
Tapestry Hibernate, it's just a Hibernate issue.



OK guys, thanks for your help.

G.



-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



tapestry5 / hibernate error: cannot be cast to

2010-06-08 Thread Genís Pujol

Hello list,

I'm getting an error and can't see why hibernate is trying to cast  when 
iterating. The function can be seen here:


http://dpaste.com/204571/

The exact error is ' java.lang.ClassCastException: [Ljava.lang.Object; 
cannot be cast to com.ngeografics.entities.UsuarioTerritorioPerfil'


Any hints will be appreciated


Regards,

Genis

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



where does tapestry5 look for component classes?

2010-06-03 Thread Genís Pujol

Hello list,

I'm getting the following error:

Caused by: java.lang.RuntimeException: Error invoking service builder 
method org.apache.tapestry5.hibernate.HibernateCor
eModule.buildHibernateSessionSource(Logger, List, RegistryShutdownHub) 
(at HibernateCoreModule.java:123) (for service 'H
ibernateSessionSource'): component class not found: 
com.mcompany.UsuarioTerritorioPerfilId


Where does tapestry look for component classes?

I do have the hibernate and the java classes files in the entities 
directory under my package...


any ideas?

greetings,

Genis

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



how to manually deploy a tapestry5 project into Tomcat

2010-05-27 Thread Genís Pujol

Hello,

Does anybody have documentation regarding how to deploy a Tapestry5 
project into Tomcat? The official docs just say it's the same as jetty...


Does one have to use Maven? can I just drop the folders into webapps (if 
so, how)?


Thanks,


Genis

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: how to manually deploy a tapestry5 project into Tomcat

2010-05-27 Thread Genís Pujol

Al 27/05/2010 17:03, En/na Josh Canfield ha escrit:
Tapestry is built using maven but your project doesn't need to care 
about that. You can download all the dependencies yourself and deploy 
your app as a WAR or an exploded webapp folder. In the end to the 
container Tapestry is just a Servlet filter.


-- Josh

On May 27, 2010, at 7:11 AM, Genís Pujol gpu...@ngeografics.com wrote:


Hello,

Does anybody have documentation regarding how to deploy a Tapestry5 
project into Tomcat? The official docs just say it's the same as 
jetty...


Does one have to use Maven? can I just drop the folders into webapps 
(if so, how)?


Thanks,


Genis

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


OK Thank you Josh :)

I've deployed it as an exploded webapp folder, but Tomcat doesn't find 
the resource, I guess I need to configure something in Tomcat?


Genís

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: how to manually deploy a tapestry5 project into Tomcat

2010-05-27 Thread Genís Pujol

Al 27/05/2010 17:03, En/na Josh Canfield ha escrit:
Tapestry is built using maven but your project doesn't need to care 
about that. You can download all the dependencies yourself and deploy 
your app as a WAR or an exploded webapp folder. In the end to the 
container Tapestry is just a Servlet filter.


-- Josh

On May 27, 2010, at 7:11 AM, Genís Pujol gpu...@ngeografics.com wrote:


Hello,

Does anybody have documentation regarding how to deploy a Tapestry5 
project into Tomcat? The official docs just say it's the same as 
jetty...


Does one have to use Maven? can I just drop the folders into webapps 
(if so, how)?


Thanks,


Genis

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

I meant that Tomcat does find the Index.tml but it doesn't pass control 
to Tapestry so it renders the template as plain text...


any clues?

G.

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



session.persist saves object with id 0

2010-05-25 Thread Genís Pujol

Hello,

After checking the tutorial I was trying to do a basic crud app, but 
somehow after submiting the form (beaneditform) the new object is saved 
into the database with id 0.


I'm also new to hibernate so I don't know why in the tapestry tutorial  
is enough with session.persist(object), what happened to the factory, 
session.commit, session.close and the Transaction object? is that all 
included with the @CommitAfter annotation?



Any idea why a new object would be saved with id 0?

regards,

Genis

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



multiselect

2010-05-21 Thread Genís Pujol

Hello,

Is there any documentation/examples about multiselect controls in 
Tapestry5? Anyone has implemented this already?


regards,

Genís

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



custom form, date input field paramater translate

2010-05-19 Thread Genís Pujol

Hello list,

I'm changing a form from the usual t:beaneditform object=myobject/ 
to a custom one using the tags:


t:beaneditform object=myobject
t:parameter name=password
t:label for=password/
t:passwordfield t:id=password value=user.password/
/t:parameter
t:parameter name=date
t:label for=date/
t:textfield t:id=date value=myobject.date/
/t:parameter
/t:beaneditorform

When adding the date field I get the following error:


Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: 
Parameter 'translate' of component admin/Usuaris:fe
chaalta is bound to null. This parameter is not allowed to be null. [at 
context:admin/Usuaris.tml, line 163]
at 
org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl$1.read(InternalComponentResourcesImpl..java



I can´t find where to add the translate property and which values to use.

Any hints?

cheers,

genis


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



basic CRUD w/ ajax,json,beaneditform (tapestry5)

2010-05-04 Thread Genís Pujol

Hello list,

I have a doubt on using other ajax libs, not the ones bundled with 
tapestry5 (so I'm not using tags on the templates but xhr calls to json 
data instead).


I have a grid listing all the objects I want to edit. When the user 
clicks on a row, it updates the input fields of the form with the 
object's data. so far so good.


My doubts:

-how can I tell the bean that processes the post request that is 
updating an instance and not creating a new one?


-how does the beaneditform handle the request?

-how does it know wether to create or update an object?

Apparently with the default ajax libs it does that automagically ;)

cheers,

Genís

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org