Adam Bien's Weblog

New Pattern, Play, Broken EJB Proxies, Network Files, Huge Apps--Or The 6th Airhacks Q & A

  1. What do you think about play framework as compared to JavaEE ? I often heard that JavaEE is heavyweight in development and therefore internet-startups uses other framework stacks like play, rails, meteor etc
  2. What would be the proper approach to read a network file in a J2E environment?
  3. “Open Extended Persistence Context In View” - a new pattern?
  4. ID generation in a cluster.
  5. State computation (daily limits) and scalability vs. consistency.
  6. Is JSF compatible with Bootstrap?
  7. The JSP / HTML 5 drama: The Return Of JSPs in HTML 5
  8. “How are you going to structure your application if application is going to be really huge. Are you still going to keep it in one big war?” blog comment by Thomas
  9. Commercial vs. free tools: gist discussion
  10. Is “Mixing storage/transfer concerns an antipattern”? Rafael Chaves, @abstratt
  11. Broken EJB proxies? Brad Davies, @bradsdavis

See also https://gist.github.com/AdamBien/8735518ee671d7edb778

The questions above are going to be answered during the next "Airhacks Q & A" http://airhacks.io live. You can subscribe to the channel and / or for the next event: http://www.ustream.tv/channel/adambien.

If you miss a question, write a comment on this post, tweet your question with the hashtag "#airhacks" or mention me https://twitter.com/AdamBien.

The best of all: you can ask the questions live, during the show using the chat: http://www.ustream.tv/channel/adambien, twitter (hashtag "#airhacks") or (the best option): using channel ##airhacks on http://freenode.net.

See you at Java EE Workshops at MUC Airport or on demand and in a location very near you: airhacks.io!


NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.

Newsletter: airhacks.news

A book about rethinking Java EE Patterns

Comments:

Hello Adam,

a JPA 2.0 questions concerning uni-directional one-to-many mapping. We had a very simple case, a mailboxmessage class with a list of attachments.
In the attachments we didnt use a many-to-one mapping back to the mailboxmessage, since its not needed in JPA 2.0 from what we read. (http://en.wikibooks.org/wiki/Java_Persistence/OneToMany#Unidirectional_OneToMany.2C_No_Inverse_ManyToOne.2C_No_Join_Table_.28JPA_2.0_ONLY.29)
When executing via a local/jdbc connection in a unit-test that worked perfectly, however in a container with a JTA-connection on JBoss 7.1 we kept getting an error that the FK cannot be null in the attachment. This could only be solved by referencing the mailboxmessage in every attachment via a many-to-one mapping. Any idea what the reason might be?

Thank you in advance!

Code excerpts of the now working code with bi-directional mapping:
@Entity
@NamedQueries({
@NamedQuery(name = "MailboxMessage.findMessageById",
query = "SELECT msg FROM MailboxMessage msg WHERE msg.m_messageId = :messageId"),
})
@Table(name = "EB_MAILBOX")
@SequenceGenerator(sequenceName = "SEQ_MESSAGES", name = "SEQ_MESSAGES_GEN")
public class MailboxMessage implements Serializable {

@Id
@Column(name = "ID")
@GeneratedValue(generator = "SEQ_MESSAGES_GEN", strategy = GenerationType.SEQUENCE)
private long m_messageId;

@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
// also had the referencedColumnName= here in the former nonworking variant
@JoinColumn(name = "MESSAGE_ID", nullable=false)
private List<Attachment> m_attachmentList;

-------

@Entity
@Table(name = "EB_MAILBOX_ATTACHMENT")
@SequenceGenerator(sequenceName = "SEQ_MAILBOX_ATTACHMENT", name = "SEQ_MAILBOX_ATTACHMENT_GEN")
public class Attachment implements Serializable {
@Id
@Column(name = "ID")
@GeneratedValue(generator = "SEQ_MAILBOX_ATTACHMENT_GEN", strategy = GenerationType.SEQUENCE)
private long m_attachmentId;

//Was needed for jta-connection in jboss
@ManyToOne
@JoinColumn(name = "MESSAGE_ID", referencedColumnName = "ID",
nullable = false, insertable = false, updatable = false)
private MailboxMessage m_message;

@Column(name = "FILE_NAME")
private String m_fileName;

@Column(name = "MIME")
private String m_mimeType;

@Column(name = "CREATION_DATE")
private Date m_creationDate;

@Column(name = "FILE_BLOB")
@Lob
private byte[] m_file;

Posted by Nico on August 29, 2014 at 02:07 PM CEST #

My opinion on 1.:

All those "rapid" prototyping frameworks fits well in the agile world ... until the Technical Debt raises in unexpected highs and then the project fails while trying to clear this debt within these frameworks.

What aspect do one like to achieve when using those frameworks? They FAKE the customer! They show the customer a set of fancy features in a rapid way and forget completely how the whole system will behave/perform/secured/scale/integrates in production environment and scenarios.

We all are very "rapid" in outdating some technologies, that becoming more and more mature.

But it's all about answering the question: "Do we REALLY know/posses these supposed-to-be-outdated technologies? (Or do we just follow a hype and parroting fashion, because this is easier than reading a JSR spec?)"

So - Are we REALLY deep experts in Java EE, that we can suppose, Java EE is outdated against <replace this with the next hyping framework's name>?

How many productive scenarios are there in the web, where those hyping frameworks fit *still* well - even when requirements changes, stakeholders tending to do common enterprise architecting or the numbers of users/requests increases dramatically?

Let us all stop fiddling around with the next hype - let us become specialists in plain and mature Java EE technology! It's all there! OOTB!

But yes: to apply it, you have to read the specs!

(...and then: don't let us use java.io.File access in Session Beans anymore, even if it works in some Application Servers (for now)!)

Robert

Posted by Robert on August 29, 2014 at 10:47 PM CEST #

java is like a one man army in the software world

Posted by Sayyednadeem on December 26, 2014 at 04:41 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
Online Workshops
...the last 150 posts
...the last 10 comments
License