Type of Serialized Object for Entity Bean
Hi,
I develop a container managed persistence entity bean. I want to persist an object that is serializable into a database column. My database column type is a Blob. I wonder what is the type of a field in my entity bean? Please help. Thanks in advance.
Cheers,
Paul Ngo
Providing you are not worried about referential integrity, CMP will do this automatically.
Similar Messages
-
Do I need to Create Primary Key Class for Entity beans with Local interface
Do I need to Create Primary Key Class for Entity beans with Local interface?
I have created my entity bean with the wizard in Sun One Studio and it does not create a primary key class for you.
I thought that the primary key class was required. My key is made up of only one field.
Anyone know the answer.
Jimu dont need to create a primary key class for a entity bean.if ur table's primary key feild(int ,float) is a built in or primitive data type,then u dont need one.But if ur table has a primary key field which is non primitive (for example StudentID,ItemID etc)then u have to create a primary key class.
hope this helps :-) -
Can we capture two types of Serial Numbers for a material?
Hi,
I have scenario where i need to capture two different types of serial numbers for a material. This scenario is very similar to the below one -
Say if a CAR is a serialized material, then i want to capture engine no. and chasis no. for each car.
I know in standard serial number management, we can capture one kind of serial no. for an item, but can we capture two types of serial number for an item? If yes, how we can do that?
Please help.
Thanks,
Parimal.Hi,
No it is not possible to have two serial numbers for a material.
The main attribute of a serial number is that it is UNIQUE.
You can better have the vehicle number as the required serial number and the other numbers under the Manufacturer data of the General data tab of the IQ01 transaction. ( Equipment master creation ).
You can better change the name of the manufacturer data such as Model number to Engine numeber and Manu serial no to Chasis no etc.., using CMOD transactions.
Regards -
How to disable cache implementation in 8.1 SP6 for entity beans
How to disable cache implementation in 8.1 SP6 for entity beans
In our production environment, we want to disable cache implementation for entity beans. We are using weblogic 8.1 SP6.
Weblogic cache implementation has been causing many cachefull exceptions so we want that it fetches the data from database everytime instead of cache.Check the "max-beans-in-cache" setting in your weblogic-ejb-jar.xml. The cache full exception, means that a new bean could not be created because of this cache being full.
Nothing to do with fetching from the database directly.
If you really want direct fetches then do not use beans at all. Consider using direct JDCB/SQL calls (without a entity bean) to fetch huge data.
Let's again review your application based on the below explanation before making a decision on which configuration change to perform:
If you truly have many ejbs simultaneously enrolled in transactions, then yes, the cache must be big enough to hold all the instances.
Your cache must have a max size large enough to handle your peak simultaneous transaction load.
Also, try to ask the following query to your application developer. Does every user actually have to have more than one bean in the cache ? Are many of these values read-only reference values that are not updated ?
SOLUTION CHOICE:
1. If you are testing with more number of users simultaneously, then you will need to increase the "max-beans-in-cache" setting in your weblogic-ejb-jar.xml to match the load.
2. If you have few users but still seeing a lot of beans, then consult with your application developer and try to ask the above questions (Does every user have more than......) and based on that try to redesign/tune your application to make it an effective Entity bean model.
3. If you have queries where huge result sets are returned, consider using plain/direct JDB/SQL calls.
Arun -
2 phase commit for entity bean
Hi all,
Does the 2-phase commit capability in WL6.X applies to entity bean?
Thanks,
RickTwo phase commit is the mechanism that allows transactions to the managed
across different servers and databases.
yes, definitely I does apply for entity beans
"Rick Lee" <[email protected]> wrote in message
news:[email protected]..
>
Hi all,
Does the 2-phase commit capability in WL6.X applies to entity bean?
Thanks,
Rick -
HT5012 Where to type the serial number for wifi
Where can I type the serial number for my IPhone 4s
The serial number of your phone has nothing at all to do with WiFi. Please rephrase the question or post in your native language.
-
How set diff. timeouts for entity beans?
How do i set diff. timeouts for diff. entity beans? Is it in the ejb-jar.xml file? Is this refreshed every time it is accesses?
Hi there,
Although not familiar with all of the App servers on the market, I'd say that you are unlikely to find a timeout value for Entity Beans. Passivation of Entity beans is normally a function of the commit options supported by a specific App server. For example, with Commit Option C an entity bean instance should always be returned to the instance pool after a transaction has completed. You can find details of the various commit options in the EJB specification which you can view or download from:
http://java.sun.com/products/ejb/docs.html
Hope this helps
Amanda
Developer Technical Support
Sun Microsystems
http://www.sun.com/developers -
Object attribute for Entity Bean?
Can I have an Object type attribute in an Entity Bean that must be mapped to a database. This Object will then only contain text attributes. For example,
class UserBean {
String name;
Address address;
class Address {
String street;
String streetnumber;
In other words: Can I use EJB's to provide the same facility that an Object-Oriented Database provides?Providing you are not worried about referential integrity, CMP will do this automatically.
-
Re: junit test for entity beans ... ejb 3.0
I'm confused. I'm trying to test my entity bean.
I have:
- an entity bean
- a stateless session bean for accessing the entity bean (facade)
- an interface for accessing the the stateless bean
And I'm trying to write a JUnit test class to test this bean. However, I am uncertain as to how to test this (I'm new to EJB 3.0, JBoss and Eclipse).
What would the JUnit test look like? I'm confused as to whether or not I should be injecting the interface/bean/what???
I've tried several variations. I either get "NameNotFound" - not bound exceptions or Null pointer exceptions.
What would the @EJB syntax look like or how would I do it through the context?
For Example:
@EJB private TestFacade myTest; //interface to stateless bean ?
OR
InitialContext ctx = new InitialContext();
TestResultFacadeBean myTest = (TestResultFacadeBean) ctx.lookup("localTest");
I'm confused at to which method I should be using and what object I should be accessing. If I could get either one to work, I'd be happy. :)
How do I ensure my bean is deployed to the container? What do I need to do?
If anyone has a simple example or explanation as to which method I should use and how to use it, I'd be very grateful.
Thanks very much,
LisaDOK, you need to have several layers of testing.
Layer 0. Test the entity beans are deployable (more on this later). Basically, you need to know that all your annotations work. Things to watch out for are multiple @Id fields in one class or @EmbeddedID or @IdClass in conjuction with @ManyToOne, @ManyToMany, @OneToMany, @OneToOne and fun with @JoinTable, @JoinColumn and @JoinColumns. Once you know how these are supposed to work with the spec, it's not too bad to write it correctly each time. But there are some gotchas that will break things later on.
Layer 1. Do the functions in the classes that don't depend on annotations work as expected. Typically, this is just going to be the getters and setters in your entity classes. Of course JUnit best practice says we don't bother testing functions that look like:
public T getX() {
return this.x;
or
public void setX(T x) {
this.x = x;
as there is nothing that can go wrong with them. So in that case, your level 1 tests will just be initial values specified from constructors and verifying that the non-get/set pairs work, and that the getters you have tagged @Transient work (because you've likely put some logic in them)
Layer 2. Test the session bean methods that don't require injection to work.
Layer 3. Test the session bean methods that require injection (Mock Objects). Simulate the injection for yourself, injecting Mock Objects for the entity manager. Then you can confirm that the correct methods are being called in the correct sequences, etc.
[Note this may require some skill in designing the mock. I'm working on developing my own entitymanager mock, and if it looks usefull I'll release it to the world.
Layer 4. Test the session bean methods that require injection (Real entity manager) (See Layer 0)
For this you will need an out of container persistence implementation. Currently Hibernate and Glassfish provide beta versions. You will need a different persistence.xml file that lists all the entities. You will have to use reflection to inject the entity manager(s) that you create from an entity manager factory unless you provide a constructor that takes an EntityManager as a parameter. You may need to use reflection to call any @PostConstruct method if you made it private.
Layer 5. Navigate the relationships in the objects returned from Layer 4 using a database that has been loaded with test data.
I am currently using Layers 0, 1, 2 & 4 to test my session beans and entity beans. -
Do JNDI look up for entity beans from a session bean in different jars
I have a problem doing entity beans JNDI look up from a session bean which is deployed
as a separate package (session.jar) from the entity beans (entity.jar)
I believe if both session bean and entity beans are deployed into one jar and
I specify ejb-local-reference-description for session bean, it should work. However,
due to some reason, they have to be in separated packages but still in the same
container. Then question how to do JNDI lookup given entity beans only have local
interfaces?
FYI.
1 both session.jar and entity.jar are self-contained. i.e., no deployment error.
each JNDI name can be viewed from JNDI tree
2. weblogic-ejb-jar.xml for session.jar
<weblogic-ejb-jar>
<description><![CDATA[Generated by XDoclet]]></description>
<weblogic-enterprise-bean>
<ejb-name>PetstoreLogic</ejb-name>
<stateless-session-descriptor>
</stateless-session-descriptor>
<reference-descriptor>
</reference-descriptor>
<jndi-name>PetstoreLogic</jndi-name>
<local-jndi-name>PetstoreLogicLocal</local-jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
3. weblogic-ejb-jar.xml (code snip) for entity.jar
<weblogic-enterprise-bean>
<ejb-name>Account</ejb-name>
<entity-descriptor>
<persistence>
<persistence-type>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
</persistence-type>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
</persistence-use>
</persistence>
</entity-descriptor>
<reference-descriptor>
</reference-descriptor>
<local-jndi-name>net.sourceforge.cpetstore/AccountLocalHome</local-jndi-name>
</weblogic-enterprise-bean>
4. if I do
accountLocalHome = (AccountLocalHome) ic.lookup("net/sourceforge/cpetstore/AccountLocalHome");
get error like:
javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException:
While trying to look up /app/ejb/net.sourceforge.cpetstore-entity.jar#Account/local-home
in /app/ejb/cpetstore-ejb.jar#PetstoreLogic.; remaining name '/app/ejb/net/sourceforge/cpetstore-entity/jar#Account/local-home'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:869)
at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:150)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)In weblogic-ejb-jar.xml use jndi-name instead of local-jndi-name in reference-descriptor
element.
"Qiming He" <[email protected]> wrote:
>
I have a problem doing entity beans JNDI look up from a session bean
which is deployed
as a separate package (session.jar) from the entity beans (entity.jar)
I believe if both session bean and entity beans are deployed into one
jar and
I specify ejb-local-reference-description for session bean, it should
work. However,
due to some reason, they have to be in separated packages but still in
the same
container. Then question how to do JNDI lookup given entity beans only
have local
interfaces?
FYI.
1 both session.jar and entity.jar are self-contained. i.e., no deployment
error.
each JNDI name can be viewed from JNDI tree
2. weblogic-ejb-jar.xml for session.jar
<weblogic-ejb-jar>
<description><![CDATA[Generated by XDoclet]]></description>
<weblogic-enterprise-bean>
<ejb-name>PetstoreLogic</ejb-name>
<stateless-session-descriptor>
</stateless-session-descriptor>
<reference-descriptor>
</reference-descriptor>
<jndi-name>PetstoreLogic</jndi-name>
<local-jndi-name>PetstoreLogicLocal</local-jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
3. weblogic-ejb-jar.xml (code snip) for entity.jar
<weblogic-enterprise-bean>
<ejb-name>Account</ejb-name>
<entity-descriptor>
<persistence>
<persistence-type>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
</persistence-type>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
</persistence-use>
</persistence>
</entity-descriptor>
<reference-descriptor>
</reference-descriptor>
<local-jndi-name>net.sourceforge.cpetstore/AccountLocalHome</local-jndi-name>
</weblogic-enterprise-bean>
4. if I do
accountLocalHome = (AccountLocalHome) ic.lookup("net/sourceforge/cpetstore/AccountLocalHome");
get error like:
javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException:
While trying to look up /app/ejb/net.sourceforge.cpetstore-entity.jar#Account/local-home
in /app/ejb/cpetstore-ejb.jar#PetstoreLogic.; remaining name '/app/ejb/net/sourceforge/cpetstore-entity/jar#Account/local-home'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:869)
at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:150)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338) -
Proxy object and entity Bean interaction
Hello,
I'd like to have some precisions on the interactions between the proxy object (client) and the entity bean(server):
- does J2EE provides ways for a bean to manage clients, to define roles and permissions, lock, etc ... ? What informations an entity bean can know about the clients ?.
- how does the context mechanism work on the entity bean side ?
- how does an entity bean identify different clients ? how does it recognize one from another ? I mean if client c1 and client c2 use same entity bean B, how B can manage different roles for c1 and c2, and how can B returns specific values to a particular client.
Thx.If you can read some tutorial, you will get all the information.
I'll suggest a book EJB by richard manson publicvations oreilly.
The activities you are talking about is responsibility of container and user developed bean are totally absytracted from this system level activities.
Primary service include security which take care of activities like Authentication, access control and secure communication.
for role based access control u have container providing the identity by Principal object. DDescriptors declare which logical roles are allowed to access even perticular method of the bean. -
Creating jar file for entity bean
I am trying to deploy an entity bean..i compiled all the java files and created a dir by name META_INF and copied ejb-jar.xml
and the other two .xml files which are needed to this dir. then using ,ant i tried to create the jar file ,,but it is giving the following error
during the process ..PLs Help me
Buildfile: build.xml
clean:
[delete] Deleting directory D:\ejb\entity\build
[delete] Deleting directory D:\ejb\entity\dist
init:
[mkdir] Created dir: D:\ejb\entity\build
[mkdir] Created dir: D:\ejb\entity\build\META-INF
[mkdir] Created dir: D:\ejb\entity\dist
compile_ejb:
[javac] Compiling 3 source files to D:\ejb\entity\build
jar_ejb:
[jar] Building jar: D:\ejb\entity\dist\Cabin.jar
ejbc:
[java] java.io.FileNotFoundException: META-INF/ejb-jar.xml not found in jar file
[java] at weblogic.ejb20.dd.xml.DDUtils.getEntry(DDUtils.java:332)
[java] at weblogic.ejb20.dd.xml.DDUtils.getEjbJarXml(DDUtils.java:236)
[java] at weblogic.ejb20.dd.xml.DDUtils.loadEJBJarDescriptorFromJarFile(DDUtils.java:151)
[java] at weblogic.ejb20.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:139)
[java] at weblogic.ejb20.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:130)
[java] at weblogic.ejbc20.runBody(ejbc20.java:338)
[java] at weblogic.utils.compiler.Tool.run(Tool.java:79)
[java] at weblogic.ejbc.main(ejbc.java:21)
[java] ERROR: java.io.FileNotFoundException: META-INF/ejb-jar.xml not found in jar file
compile_webapp:
Total time: 20 secondThe Ejb jar file structure for WebLogic server:
META-INF/ejb-jar.xml
META-INF/weblogic-ejb-jar.xml
META-INF/weblogic-cmp-rdbms-jar.xml
Ejb Bean Class
Remote interface
Home interface -
Package structure suitable for entity beans
hi,
I have to manage some good number of entity beans ( around 250 )
is it a good idea to package these beans.
i mean what number of packages could be an idea one.
currently we have 5 packages and around 50 beans will be in each.
can anybody suggest on this..package structure should be based more on the business context rather than number of beans. Usually it is of the form..
org/com.<company_name>.<proj_name>.<context>.entity
for instance...a good package structe example is
org.apache.log4j.Category !
If you have customer and order beans then
com.walmart.pos.customer.entity
com.walmart.pos.order.entity
hth...
sanjay. -
Cannot Type Full Serial Number for Flash Pro CS5.5 STUDENT
Flash Professional CS5.5 STUDENT & Teacher Edition has several letters in the beginning of the serial number unlike the standard releases. I have purchased my copy from Amazon.com and I have installed my copy fine once before but my computer crashed recently and now I cannot reinstall Flash Pro because it won't let me type letters into the serial form, only numbers. I have tried typing them normally, using shift, copy and pasting them... nothing. Is there any other way that I can input the serial number or fix whatever isn't letting me type letters?
Thanks,
ZThere are two "serial" numbers (the product number) that came on the product packaging.
The software is Adobe Flash Professional CS5.5 Student and Teacher Edition, purchased from Amazon.com and needed student verification to obtain the license.
^ [ I figured out what was wrong, but I'll just leave the information here for anyone in the future that may have short-term memory as well ]
I have just went through my records that I recovered from my laptop and it seems that the serial number on the product package DOES IN FACT have letters in it. But I think that I had to register it with Adobe and verify that I was a student before Adobe would give me my legitimate serial number that contained only numbers. So this is why there are tons of these threads about this that never go answered because the people asking and the people helping are both right and wrong at the same time. The students are trying to use the only serial that was provided to them, but it isnt the true serial. Maybe Adobe could be more clear that it isn't a serial number for the product underneath it? "Product Code" is synonymous with "Serial Number" to most people.
You use this code (the code with letters in it; the "product code") to contact Adobe and verify your status as a studen/teacher and then they give you the true serial number that is all numbers. Search your email for mail from Adobe to find your serial if you have already done this. I had completely forgotten how the process worked since it was a while ago.
Thanks for the help Mylenium, I hope this helps whoever comes across it in the future. -
Using serialized objects for 'static' perso
Hi,
I guess this is food for thought. I am looking at the following avenue.
use serialized objects - compliant with the back office software - as 'static' perso. by static I mean all perso data that the card simply stores and does not need to use/modify to function.
These objects could change over time (data and methods) without having to re-issue card applications; and many "genertions" of cards could exist on the field as the back office software would know how to adjut to them.
Has this been done/looked at before ?
Regards,
PhilippeHi,
What I meant was use objects serialized by software (outside of the card) to personalize easily all data that:
1) have the same access security level
2) do not need any modification/understanding from the applet
My post is quite old now ...
I actually have done it and it is quite useful, at least to setup prototypes.
Regards,
Philippe
Maybe you are looking for
-
I have Comcast.net. From my home page, when I click the email button, first, I must sign-in and then a preview page appears with a short list of emails. When I click the tab to open the entire email page, the entire page does not open as it should. W
-
my macbook will maintain the charge it has but wont charge more. i have tried a new battery and a new charger... nothing will work! please help
-
Move focus from one to another itemRenderer inside DataGrid itemRenderer
I have a mx: DataGrid with 4 columns that have a itemRenderer with the following settings: - Mx:DataGrid: <code> <mx:DataGrid id="itensPedidoCompraList" width="100%" height="120" dataProvider="{ model.pedidoCompra.itens }" editable="true" it
-
I am trying to find out why the Photo books I ordered from Iphoto cant be sent to france which is where I live most of the time
-
Hello: Please let me know if there is a link to follow the instructions to install Oracle 10g in Solaris 10g. Thnks Paola