Author: danielc.roth
Date: 2009-04-10 21:20:42 -0400 (Fri, 10 Apr 2009)
New Revision: 10380
Modified:
trunk/examples/ui/src/org/jboss/seam/example/ui/FilmConverter.java
Log:
Fix for JBSEAM-4104
Modified: trunk/examples/ui/src/org/jboss/seam/example/ui/FilmConverter.java
===================================================================
--- trunk/examples/ui/src/org/jboss/seam/example/ui/FilmConverter.java 2009-04-10 23:38:47
UTC (rev 10379)
+++ trunk/examples/ui/src/org/jboss/seam/example/ui/FilmConverter.java 2009-04-11 01:20:42
UTC (rev 10380)
@@ -1,45 +1,42 @@
package org.jboss.seam.example.ui;
-import java.io.Serializable;
-
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
import javax.persistence.EntityManager;
-import org.jboss.seam.annotations.In;
+import org.jboss.seam.Component;
import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Transactional;
+import org.jboss.seam.annotations.faces.Converter;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
@Name("filmConverter")
-(a)org.jboss.seam.annotations.faces.Converter(forClass=Film.class)
+@Converter(forClass = Film.class)
@BypassInterceptors
-public class FilmConverter implements Converter, Serializable
+public class FilmConverter implements javax.faces.convert.Converter
{
- @In
- private EntityManager entityManager;
-
- @Transactional
public Object getAsObject(FacesContext context, UIComponent component, String value)
{
+
+ EntityManager entityManager = (EntityManager)
Component.getInstance("entityManager");
+
if (value != null)
{
- try
+ try
{
Integer id = Integer.parseInt(value);
if (id != null)
{
return entityManager.find(Film.class, id);
}
- }
- catch (NumberFormatException e) {
}
+ catch (NumberFormatException e)
+ {
+ }
}
- return null;
+ return null;
}
-
+
public String getAsString(FacesContext context, UIComponent component, Object value)
{
if (value instanceof Film)
@@ -52,5 +49,5 @@
return null;
}
}
-
+
}
Show replies by date