Lançado Mentawai 1.8  XML
Índice dos Fóruns » Notícias
Autor Mensagem
saoj
JWizard
[Avatar]

Membro desde: 09/03/2004 23:34:46
Mensagens: 2667
Localização: Chicago, EUA
Offline

Várias melhorias nessa versão, das quais podemos destacar a validacão e autorização dinâmicas, suporte a String ids para as listas (antes só podia inteiro), migração do código do framework para Java 5 com refactoring para incluir generics e o HibernateFilter em modo transacional. Obrigado a todos que colaboraram com feedback e sugestões!

http://www.mentaframework.org/

Lista completa de mudanças aqui:



- new methods in the Input interface to fetch a populated bean from the input parameters: (idea by Bruno Braga)

(this can be also accomplished by using a VOFilter)

getObject(Class klass)
getObject(Class klass, String prefix);

- new methods in the Output interface to place the properties of a bean inside the action output: (idea by Bruno Braga)

(this can be also accomplished by using a OVFilter);

setObject(Object bean);
setObject(Object bean, String prefix);

Ex:

User user = (User) getObject(User.class);

- new DynValidatable interface to allow dynamic validations, in other words, the prepareValidator
method from the interface will be called on every request instead of just in the first one like it
is the case for Validatable.

- new parameter (isDynamic) for the ValidationFilter constructor, so that is can also become dynamic.

- ClassActionConfig is now deprecated. You can use the ActionConfig to support the same functionality...

Ex:

Instead of:

ActionConfig ac = new ClassActionConfig(HelloAction.class);

You can use:

ActionConfig ac = new ActionConfig(HelloAction.class);

- Inner actions were not supporting inheritance, in other words, they were using getDeclaredMethod instead of getMethod.

- new method getDate for the Input interface, so you can fetch a converted date from the action input.

- new DynAuthorizationFilter and Authorizable interface so that you can implement dynamic and complex authorization logic for your actions!

- method getInnerActionName() from Controller was changed to receive HttpServletRequest instead of the action name.
(If you are implementing your own controller extending the Mentawai controller, you may have to change that method in your class)

- ListManager.convert(String listname, List data, String keyProperty, String valueProperty) was refactored to accept a Collection instead of a List

- ListItem interface introduced. Now ListDataItem implements ListItem and all framework works with ListItem.

- As a result of the 2 changes above, now you can pass a regular Collection as a list to a select, listCheckboxes and listRadiobuttons. The rule is simple:

If the element of the collection is a ListItem, call appropriate getIdAsString() and getValue from the interface to get the ID and the VALUE for the option.

If the element is not a ListItem, then the ID and the VALUE will be equal to element.toString().

Note that you can still use the ListManager.convert(String listname, List data, String keyProperty, String valueProperty) and the ListManager.convert(String listname, Map data).

- convert methods of ListManager does not need a listName anymore (a listName is only needed if you plan to add the ListData to the ListManager as a static list!)

- HibernateFilter now supports the transactional mode, which will open a transaction everytime a session is requested. (Hey, Hibernate authors recommend using a transaction even when just a read operation is being made, so don't blame on me! http://www.manning.com/bauer2/chapter2.pdf)

- framework code migration to TIGER and refactoring to support generics throughout the code

- bug fix to support MUSTANG




Sergio A Oliveira Jr. - saoj

ExperiMENTA:

Mentawai = http://www.mentaframework.org - Full-stack Java Web Framework com Configuracão Programática
MentaQueue = http://mentaqueue.soliveirajr.com - Queue de alta-performance.
MentaLog = http://mentalog.soliveirajr.com - Non-intrusive, fast, garbage-less, colored and straightforward logging
MentaBean = http://mentabean.soliveirajr.com - Tiny ORM with SQL Builder
MentaRegex = http://mentaregex.soliveirajr.com - Perl-style regex for Java.
MentaContainer = http://mentacontainer.soliveirajr.com - Straightforward IoC, DI e Auto-Wiring
Space4J = http://www.space4j.org - Banco-de-dados de Objetos em Memória
Options-Lib = https://github.com/saoj/options-lib - Ruby classes para ter acesso as opcoes do Yahoo Finance
Selleto = http://www.selleto.com.br
Flipinion = http://www.flipinion.com
Kawai = http://www.kawaiwiki.org


[Email] [WWW]
Daniel Quirino Oliveira
Moderador
[Avatar]

Membro desde: 23/03/2003 23:57:34
Mensagens: 3299
Localização: Awawawawa (Araraquara) - SP
Offline

Você não precisa abrir uma transação com o Hibernate a cada sessão utilizada. Embora o exemplo dado pelo C. Bauer mostre uma transação sendo aberta para uma operação read-only, aquele exemplo apenas ilustra o potencial da ferramenta em si (algo como "hey! se você quiser abrir uma transação para uma operação read-only, está tudo bem! O hibernate permite! ") e não é uma recomendação ou boa prática. Acho que seria interessante vocês revisarem este HibernateFilter ou, pelo menos, permitir que o usuário escolha a maneira de lidar com transações (mesmo porque, se eu quiser usar Container Managed Transaction Demarcation, teria que deixar que o meu contexto transacional (JTA) cuidasse do fluxo da minha transação, certo?).

Daniel Quirino Oliveira
[Email] [WWW]
saoj
JWizard
[Avatar]

Membro desde: 09/03/2004 23:34:46
Mensagens: 2667
Localização: Chicago, EUA
Offline

O modo transacional é totalmente opcional, ou seja, vc escolhe se quer usar ele ou não passando uma boolean para o construtor do HibernateFilter. O default é para não usar, ou seja, vc mesmo controla como quer fazer as transações. Nada te impede também de usar o TransactionFilter (com ou sem o modo transacional do HibernateFilter) para deixar a sua action atomica e melhor controlar em que situações um rollback ou commit irão acontecer.

Se não é uma recomendação ou boa prática, então eles não deveriam ter dado isso como exemplo, ainda mais no HelloWorld. Já vi em diversos outros lugares exemplos onde é recomendado transação para tudo no hibernate, até para select, como foi o caso do exemplo em questão. Parece que eles realmente recomendam transaçao para tudo, até para SELECT, quando na teoria uma transação deveria ser exceção e não regra. Mais sobre isso aqui: http://www.guj.com.br/posts/list/50471.java

O ideal é usar o HibernateFilter sem modo transacional, o que é o default de qualquer maneira. Mas se por algum motivo vc quiser ou tiver que fazer uma transaçao para TUDO, o modo transacional vai facililtar isso...

Sergio A Oliveira Jr. - saoj

ExperiMENTA:

Mentawai = http://www.mentaframework.org - Full-stack Java Web Framework com Configuracão Programática
MentaQueue = http://mentaqueue.soliveirajr.com - Queue de alta-performance.
MentaLog = http://mentalog.soliveirajr.com - Non-intrusive, fast, garbage-less, colored and straightforward logging
MentaBean = http://mentabean.soliveirajr.com - Tiny ORM with SQL Builder
MentaRegex = http://mentaregex.soliveirajr.com - Perl-style regex for Java.
MentaContainer = http://mentacontainer.soliveirajr.com - Straightforward IoC, DI e Auto-Wiring
Space4J = http://www.space4j.org - Banco-de-dados de Objetos em Memória
Options-Lib = https://github.com/saoj/options-lib - Ruby classes para ter acesso as opcoes do Yahoo Finance
Selleto = http://www.selleto.com.br
Flipinion = http://www.flipinion.com
Kawai = http://www.kawaiwiki.org


[Email] [WWW]
Alexandre Ferreira
Virtual Machine Man
[Avatar]

Membro desde: 20/09/2006 20:07:03
Mensagens: 520
Localização: Rio de Janeiro
Offline

As mudancas realmentes foram boas...

Sobre o hibernate, voltou a falar...
foi somente um exemplo para mostrar o poder.

Acredito que nao tenha perca ou ganho de desempenho significativo com o uso ou sem o uso.

Mas acho que não seja necessario...

[]'s!

experiMENTA!

Alexandre Ferreira
Blog: http://alexandreferreira.com.br
[WWW] [MSN]
saoj
JWizard
[Avatar]

Membro desde: 09/03/2004 23:34:46
Mensagens: 2667
Localização: Chicago, EUA
Offline

afsrj wrote:
foi somente um exemplo para mostrar o poder.


Na minha opinião fazer uma coisa desnecessária e meio sem sentido não é demonstração de poder...

Ninguem questiona o poder do Hibernate. A questão é que para coisas simples ele acaba sendo complexo...

Sergio A Oliveira Jr. - saoj

ExperiMENTA:

Mentawai = http://www.mentaframework.org - Full-stack Java Web Framework com Configuracão Programática
MentaQueue = http://mentaqueue.soliveirajr.com - Queue de alta-performance.
MentaLog = http://mentalog.soliveirajr.com - Non-intrusive, fast, garbage-less, colored and straightforward logging
MentaBean = http://mentabean.soliveirajr.com - Tiny ORM with SQL Builder
MentaRegex = http://mentaregex.soliveirajr.com - Perl-style regex for Java.
MentaContainer = http://mentacontainer.soliveirajr.com - Straightforward IoC, DI e Auto-Wiring
Space4J = http://www.space4j.org - Banco-de-dados de Objetos em Memória
Options-Lib = https://github.com/saoj/options-lib - Ruby classes para ter acesso as opcoes do Yahoo Finance
Selleto = http://www.selleto.com.br
Flipinion = http://www.flipinion.com
Kawai = http://www.kawaiwiki.org


[Email] [WWW]
obattousai
Debugger

Membro desde: 27/07/2006 08:47:33
Mensagens: 64
Offline

Dale MENTA!!!



[MSN]
fmeyer
Moderador
[Avatar]
Membro desde: 22/02/2005 17:26:29
Mensagens: 1583
Localização: Sao Paulo
Offline

saoj wrote:Na minha opinião fazer uma coisa desnecessária e meio sem sentido não é demonstração de poder...
Ninguem questiona o poder do Hibernate. A questão é que para coisas simples ele acaba sendo complexo...


christian@hibernate.org

Fernando Meyer http://fernandomeyer.com
[Email] [WWW]
 
Índice dos Fóruns » Notícias
Ir para:   
Powered by JForum 2.1.8 © JForum Team