First of all, I never used cassandra, I will only answer in regard to the ByteBuffer part.
You should put everything into the bytebuffer first before sending the bytes, otherwise you cannot control the endianess of what you are storing, and thats exactly the point of using the ByteBuffer.
To send the bytes use:
int size = 2 + 8 + 4 + attributeValue.length; // short is 2 bytes, long 8 and int 4
ByteBuffer bbuf = ByteBuffer.allocate(size);
bbuf.order(ByteOrder.BIG_ENDIAN);
bbuf.putShort(employeeId);
bbuf.putLong(lastModifiedDate);
bbuf.putInt(attributeValue.length);
bbuf.put(attributeValue);
bbuf.rewind();
// this is a bad approach because if you modify the returned array
// you are directly modifying the ByteBuffer's internal array.
byte[] bytesToStore = bbuf.array();
// best approach is copy the internal buffer
byte[] bytesToStore = new byte[size];
bbuf.get(bytesToStore);
now you can store bytesToStore, sending them to cassandra.
To read them back:
byte[] allWrittenBytesTest = magicFunctionToAcquireDataFromCassandra();
ByteBuffer bb = ByteBuffer.wrap(allWrittenBytesTest);
bb.order(ByteOrder.BIG_ENDIAN);
bb.rewind();
int size = allWrittenBytesTest.length - 14;
short employeeId = bb.getShort();
long lastModifiedDate = bb.getLong();
int attributeValueLen = bb.getInt();
byte[] attributeValue = new byte[size];
bb.get(attributeValue); // read attributeValue from the remaining buffer
You don't even need to store the attributeValue length, because the length can be determined again, by subtracting 14 from allWrittenBytesTest.length (being 14 the sum of the other fields size [2 + 4 + 8]).
Edited the code, I had some typos.