Skip to content

Instantly share code, notes, and snippets.

View sajithdilshan's full-sized avatar

Sajith Edirisinghe sajithdilshan

View GitHub Profile
const element =
(
<h1 className="greeting">
Hello, world!
</h1>
);
import React, { Component } from 'react';
class App extends Component {
render() {
return (
<div className="greeting">
<h1> Hello World! </h1>
</div>
);
}
Map<Object, Object> savedResources = new HashMap<>();
Map<Object, Object> resources = TransactionSynchronizationManager.getResourceMap();
if (resources != null) {
for (Map.Entry e : resources.entrySet()) {
savedResources.put(e.getKey(), e.getValue());
TransactionSynchronizationManager.unbindResource(e.getKey());
}
}
@Override
protected boolean doReceiveAndExecute(Object invoker, Session session, MessageConsumer consumer, TransactionStatus status) throws JMSException {
if (status != null) {
TransactionInformation.txnStatus.set(status);
}
return super.doReceiveAndExecute(invoker, session, consumer, status);
}
public class TransactionInformation {
public static ThreadLocal<TransactionStatus> txnStatus = new ThreadLocal();
}
from user in Test.User,
join: group in assoc(u, :GROUPS),
where: user.'ID' == 6,
select: group
defmodule Test.Group do
use Test.Web, :model
@primary_key {:ID, :id, autogenerate: true}
schema "TEST_GROUPS" do
field :NAME, :string
belongs_to :TENANT, Test.Tenant, foreign_key: :TENANT_ID, references: :ID
has_many :PERMISSIONS, Test.Permission, foreign_key: :GROUP_ID, references: :ID
defmodule Test.Permission do
use Test.Web, :model
@primary_key {:ID, :id, autogenerate: true}
schema "TEST_PERMISSIONS" do
field :NAME, :string
belongs_to :GROUP, Test.Grup, foreign_key: :GROUP_ID, references: :ID
end
defmodule Test.User do
use Test.Web, :model
@primary_key {:ID, :id, autogenerate: true}
schema "TEST_USERS" do
field :NAME, :string
belongs_to :TENANT, Test.Tenant, foreign_key: :TENANT_ID, references: :ID
many_to_many :GROUPS, Test.Group, join_through: "TEST_GROUPS_USERS", join_keys: [GROUP_ID: :ID, USER_ID: :ID]
defmodule Test.Tenant do
use Test.Web, :model
@primary_key {:ID, :id, autogenerate: true}
schema "TEST_TENANTS" do
field :NAME, :string
end
end