[EJB 3.0] - Need some help with mapping
by MikeDougherty
OK, I would appreciate a little help with a mapping issue I am running into. I have what I will call a Type table. This table looks something like this:
| +------------+--------------+
| | Field | Type |
| +------------+--------------+
| | TABLE_NAME | varchar(25) |
| | ITEM_ID | varchar(10) |
| | ITEM_FIELD | varchar(25) |
| | ITEM_VALUE | varchar(255) |
| +------------+--------------+
|
The TABLE_NAME, ITEM_ID, and ITEM_FIELD columns make up the primary key.
I have this table mapped to a Type object, with a TypePK @IdClass. This works fine.
However, what I need to do is map certain rows in this table to a field in another object. For example, if my STORE table looks like:
| +------------+--------------+
| | Field | Type |
| +------------+--------------+
| | STORE_NAME | varchar(255) |
| | STORE_ID | varchar(10) |
| | STORE_TYPE_ID | varchar(25) |
| +------------+--------------+
|
The STORE_TYPE_ID value needs to be mapped to the ITEM_ID field in the TYPE table where TABLE_NAME = "STORE" and an ITEM_FIELD = "STORE_TYPE".
I've tried subclassing Type (with @Inheritance, and @DiscriminatorValue annotations) but that does not seem to be giving me the desired result.
| @Entity
| @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
| @DiscriminatorColumn(name="LIST_FIELD", discriminatorType = DiscriminatorType.STRING)
| @DiscriminatorValue("STORE_TYPE")
| public class StoreType extends Type {
| }
|
| entityManager.createQuery("select storeType from StoreType storeType");
|
Generates the following error:
| Caused by: java.sql.SQLException: ORA-00942: table or view does not exist
|
Any ideas how I might be able to annotate these objects in order to get the result I am looking for?
| @Entity
| @Table(name = "STORE")
| public class Store implements Serializable {
| @Id
| @Column(name = "STORE_ID")
| public Long getId() {
| return id;
| }
|
| public void setId(Long id) {
| this.id = id;
| }
|
| @OneToOne(mappedBy="id")
| public StoreType getType() {
| return type;
| }
|
| public void setType(StoreType type) {
| this.type = type;
| }
|
| @Column(name = "STORE_NAME")
| public String getName() {
| return name;
| }
|
| public void setName(String name) {
| this.name = name;
| }
| }
|
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032498#4032498
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032498
19Â years
[Security & JAAS/JBoss] - JAAS+JBOSS
by marcelo.leite
Hi,
I've just configured a security enviroment using JAAS+JBOSS. It works well. I've created a login module stack with a login module dummy that is only used for log and a org.jboss.security.auth.spi.UsersRolesLoginModule that effectively execute the authentication.
Using a simple web app (only some JSPs and a session listener) i can login and logout without problems. The login module dummy registers the access for each method called in the login process and i can see it on logs. I can use it with SSO and it works fine.
When i execute the logout in the web app, that is, invalidate() the session, i can see on the log that the logout() method has been executed, but when the user session expires it doesn't happen. The logout() method is only executed on the next time that the same user try to login.
I saw that a LoginContext can only authenticate one Subject per time, this LoginContext is responsible to call the login module. When the session expires the LoginContext "dies" with this session and is it because of this the logout() method call doesn't happen?
Is there a way to force a call to login module to guarantee that the logout() method will be called?
Can someone help me?
Best Regards
Marcelo
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032496#4032496
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032496
19Â years